Bug 1289879 - Activate the mozharness virtualenv when running tests on interactive workers, r=armenzg
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 20 Jul 2016 16:40:40 -0400
changeset 332464 f3d6887279f8175b0d1e3835d1ca2a152bc4453f
parent 332463 52f229a7749e9b4c2c8b59a9f5699038801da001
child 332465 474c03c87e8c80a313be0af14c56049b298027bb
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarmenzg
bugs1289879
milestone50.0a1
Bug 1289879 - Activate the mozharness virtualenv when running tests on interactive workers, r=armenzg There are some packages like 'requests' that are bundled in the mozharness venv, but not in the test package. It would be easy to manually add these to sys.path in the mach bootstrap script, but it's much nicer to simply activate this virtualenv in the first place. MozReview-Commit-ID: 8xeJEIgUbLj
taskcluster/scripts/tester/run-wizard
--- a/taskcluster/scripts/tester/run-wizard
+++ b/taskcluster/scripts/tester/run-wizard
@@ -53,16 +53,23 @@ def setup():
     build_dir = os.path.expanduser(os.path.join('~', 'workspace', 'build'))
     mach_src = os.path.join(build_dir, 'tests', 'mach')
     mach_dest = os.path.expanduser(os.path.join('~', 'bin', 'mach'))
 
     if os.path.exists(mach_dest):
         os.remove(mach_dest)
     os.symlink(mach_src, mach_dest)
 
+    activate = os.path.join(build_dir, 'venv', 'bin', 'activate')
+    if os.path.isfile(activate):
+        # TODO Support other shells
+        bashrc = os.path.expanduser(os.path.join('~', '.bashrc'))
+        with open(bashrc, 'ab') as f:
+            f.write(". {}".format(activate))
+
     print("""
 Mozharness has finished downloading the build and tests to:
 {}
 
 A limited mach environment has also been set up and added to the $PATH, but
 it may be missing the command you need. To see a list of commands, run:
     $ mach help
 """.lstrip().format(build_dir))