Bug 1499061 - Only do wpt mozdevice imports when running fennec, r=gbrown
authorJames Graham <james@hoppipolla.co.uk>
Mon, 15 Oct 2018 14:44:08 +0000
changeset 489642 9b9dcee0058edfd5020f141285e021cc912c27d4
parent 489641 04459ddd517a051f4dd0c69c6177de1a61921bc9
child 489643 dcd095eb89108d1171c25b9d32ca01a6d317087f
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersgbrown
bugs1499061
milestone64.0a1
Bug 1499061 - Only do wpt mozdevice imports when running fennec, r=gbrown Otherwise some users see problems due to missing psutil. Differential Revision: https://phabricator.services.mozilla.com/D8715
testing/web-platform/mach_commands.py
--- a/testing/web-platform/mach_commands.py
+++ b/testing/web-platform/mach_commands.py
@@ -22,24 +22,25 @@ from mach.decorators import (
 
 from mach_commands_base import WebPlatformTestsRunner, create_parser_wpt
 
 
 class WebPlatformTestsRunnerSetup(MozbuildObject):
     default_log_type = "mach"
 
     def kwargs_common(self, kwargs):
-        from mozrunner.devices.android_device import verify_android_device, grant_runtime_permissions
         build_path = os.path.join(self.topobjdir, 'build')
         here = os.path.split(__file__)[0]
         tests_src_path = os.path.join(here, "tests")
         if build_path not in sys.path:
             sys.path.append(build_path)
 
         if kwargs["product"] == "fennec":
+            # Note that this import may fail in non-fennec trees
+            from mozrunner.devices.android_device import verify_android_device, grant_runtime_permissions
             verify_android_device(self, install=True, verbose=False, xre=True)
 
             # package_name may be non-fennec in the future
             package_name = kwargs["package_name"]
             if not package_name:
                 package_name = self.substs["ANDROID_PACKAGE_NAME"]
 
             grant_runtime_permissions(self, package_name, kwargs["device_serial"])