Bug 1290765 - Install websocketprocessbridge requirements when running media mochitests with mach, r=gps
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Tue, 23 Aug 2016 11:13:19 -0400
changeset 348877 626134b9080e4355f25b8e97c19cacfb7575a481
parent 348876 6a47316764f049e364e93403c60481a04ff57b31
child 348878 5b4f52f937d2f06030cca5848d97598653495abd
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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] = []