Bug 1322721 - Fix test_geckoinstance.py to pass for Fennec. r=maja_zf a=test-only
authorHenrik Skupin <mail@hskupin.info>
Fri, 09 Dec 2016 21:22:07 +0100
changeset 352915 0cfa89b9d33518797597a8dafd33122ae6745514
parent 352914 c7f071262fbc3862dd41c8bc7d89999e2926126b
child 352916 450277eb1728b1ac8843f684d0a1474462d91c6d
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf, test-only
bugs1322721
milestone52.0a2
Bug 1322721 - Fix test_geckoinstance.py to pass for Fennec. r=maja_zf a=test-only MozReview-Commit-ID: 3ufR3ckAGAo
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/harness/marionette/tests/unit/test_geckoinstance.py
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -190,24 +190,25 @@ class GeckoInstance(object):
                 if self.workspace:
                     profile_args["path_to"] = os.path.join(self.workspace,
                                                            profile_name)
                 self.profile = Profile.clone(**profile_args)
 
     @classmethod
     def create(cls, app=None, *args, **kwargs):
         try:
-            if not app:
-                app_id = mozversion.get_version(binary=kwargs.get('bin'))['application_id']
+            if not app and kwargs["bin"] is not None:
+                app_id = mozversion.get_version(binary=kwargs["bin"])["application_id"]
                 app = app_ids[app_id]
 
             instance_class = apps[app]
-        except KeyError:
+        except (IOError, KeyError):
+            exc, val, tb = sys.exc_info()
             msg = 'Application "{0}" unknown (should be one of {1})'
-            raise NotImplementedError(msg.format(app, apps.keys()))
+            raise NotImplementedError, msg.format(app, apps.keys()), tb
 
         return instance_class(*args, **kwargs)
 
     def start(self):
         self._update_profile()
         self.runner = self.runner_class(**self._get_runner_args())
         self.runner.start()
 
--- a/testing/marionette/harness/marionette/tests/unit/test_geckoinstance.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_geckoinstance.py
@@ -10,18 +10,15 @@ class TestGeckoInstance(MarionetteTestCa
 
     def test_create(self):
         """Test that the correct gecko instance is determined."""
         for app in apps:
             # If app has been specified we directly return the appropriate instance class
             self.assertEqual(type(GeckoInstance.create(app=app, bin="n/a")),
                              apps[app])
 
-        # When using mozversion to detect the instance class, it should never return the
-        # base GeckoInstance class.
-        self.assertNotEqual(GeckoInstance.create(bin=self.marionette.bin),
-                            GeckoInstance)
-
         # Unknown applications and binaries should fail
         self.assertRaises(NotImplementedError, GeckoInstance.create,
-                          app="n/a", binary=self.marionette.bin)
-        self.assertRaises(IOError, GeckoInstance.create,
+                          app="n/a", bin=self.marionette.bin)
+        self.assertRaises(NotImplementedError, GeckoInstance.create,
                           bin="n/a")
+        self.assertRaises(NotImplementedError, GeckoInstance.create,
+                          bin=None)