Bug 1290765 - Install websocketprocessbridge requirements when running media mochitests with mach, r?gps draft
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 23 Aug 2016 11:13:19 -0400
changeset 437701 8f691a7c401710bb943ed700129c8e807720ccbc
parent 437700 e35ef4eb283704172f4f1dc5ae1fb498ab9da7ca
child 536708 bc775609f608ebf8232d302643c4c2ad8c4d9ea3
push id35492
push userahalberstadt@mozilla.com
push dateFri, 11 Nov 2016 14:02:36 +0000
reviewersgps
bugs1290765
milestone52.0a1
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
testing/mochitest/mach_commands.py
--- 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] = []