~dandrader/unity8/multiInstanceApp

« back to all changes in this revision

Viewing changes to tests/autopilot/unity8/shell/tests/__init__.py

  • Committer: Dimitri John Ledkov
  • Date: 2014-02-22 00:12:49 UTC
  • mfrom: (519.2.7 py3_update)
  • mto: This revision was merged to the branch mainline in revision 736.
  • Revision ID: dimitri.ledkov@canonical.com-20140222001249-cysi0p4hjtz2sl6s
Ship python3 autopilot modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
    @classmethod
86
86
    def setUpClass(cls):
87
87
        try:
88
 
            output = subprocess.check_output([
89
 
                "/sbin/initctl",
90
 
                "status",
91
 
                "unity8"
92
 
            ], stderr=subprocess.STDOUT)
93
 
        except subprocess.CalledProcessError, e:
 
88
            output = subprocess.check_output(
 
89
                ["/sbin/initctl", "status", "unity8"],
 
90
                stderr=subprocess.STDOUT,
 
91
                universal_newlines=True,
 
92
            )
 
93
        except subprocess.CalledProcessError as e:
94
94
            sys.stderr.write(
95
95
                "Error: `initctl status unity8` failed, most probably the "
96
96
                "unity8 session could not be found:\n\n"
218
218
    def _patch_environment(self, key, value):
219
219
        """Wrapper for patching env for upstart environment."""
220
220
        try:
221
 
            current_value = subprocess.check_output([
222
 
                "/sbin/initctl",
223
 
                "get-env",
224
 
                "--global",
225
 
                key
226
 
            ], stderr=subprocess.STDOUT).rstrip()
 
221
            current_value = subprocess.check_output(
 
222
                ["/sbin/initctl", "get-env", "--global", key],
 
223
                stderr=subprocess.STDOUT,
 
224
                universal_newlines=True,
 
225
            ).rstrip()
227
226
        except subprocess.CalledProcessError:
228
227
            current_value = None
229
228
 
305
304
 
306
305
        binary_arg = "BINARY=%s" % binary_path
307
306
        extra_args = "ARGS=%s" % " ".join(args)
308
 
        env_args = ["%s=%s" % (k, v) for k, v in self._environment.iteritems()]
 
307
        env_args = ["%s=%s" % (k, v) for k, v in self._environment.items()]
309
308
        all_args = [binary_arg, extra_args] + env_args
310
309
 
311
310
        self.addCleanup(self._cleanup_launching_upstart_unity)