Bug 1290765 - Install websocketprocessbridge requirements when running media mochitests with mach, r?gps
Automatically install websocketprocessbridge_requirements.txt if we detect the 'media' subsuite will be run.
We need to modify sys.executable so the virtualenv python gets used when starting up the
websocketproccessbridge. We probably should use multiprocessing instead, but that is out of scope for this
bug.
MozReview-Commit-ID: 3lOutbcSzIY
--- a/testing/mochitest/mach_commands.py
+++ b/testing/mochitest/mach_commands.py
@@ -389,16 +389,26 @@ class MachCommands(MachCommandBase):
unsupported.add(key)
continue
elif subsuite and test.get('subsuite', '') != subsuite:
unsupported.add(key)
continue
suites[key].append(test)
+ if ('mochitest', 'media') in suites:
+ req = os.path.join('testing', 'tools', 'websocketprocessbridge',
+ 'websocketprocessbridge_requirements.txt')
+ self.virtualenv_manager.activate()
+ self.virtualenv_manager.install_pip_requirements(req, require_hashes=False)
+
+ # sys.executable is used to start the websocketprocessbridge, though for some
+ # reason it doesn't get set when calling `activate_this.py` in the virtualenv.
+ sys.executable = self.virtualenv_manager.python_path
+
# This is a hack to introduce an option in mach to not send
# filtered tests to the mochitest harness. Mochitest harness will read
# the master manifest in that case.
if not resolve_tests:
for flavor in flavors:
key = (flavor, kwargs.get('subsuite'))
suites[key] = []