Bug 1289879 - Activate the mozharness virtualenv when running tests on interactive workers, r?armenzg draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 20 Jul 2016 16:40:40 -0400
changeset 393923 c35e54436f9e5431ff162c0ca69275a2788905af
parent 393861 9ec789c0ee5bd3a5e765513c21027fdad953b022
child 526700 6962c2cfbc802d6856daf7430ef331fd9333c28e
push id24448
push userahalberstadt@mozilla.com
push dateThu, 28 Jul 2016 19:59:19 +0000
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))