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
--- 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))