Bug 1370899 - mock_runner.driverclass should return mock_marionette; r=whimboo
authorMaja Frydrychowicz <mjzffr@gmail.com>
Wed, 07 Jun 2017 10:32:04 -0400
changeset 411419 6c8c383edd02189f7a1e52d93e36b1be9d60197f
parent 411418 69bc2ed7ebb5e5721d46b7edd06618c984e36560
child 411420 ae620d7e41e2d88e9145a3c744dda13eee92c26e
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswhimboo
bugs1370899
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1370899 - mock_runner.driverclass should return mock_marionette; r=whimboo Previously, mock_runner.driverclass() returned a plain Mock object. MozReview-Commit-ID: 1RMQhud4BJD
testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py
@@ -87,14 +87,14 @@ def mock_httpd(request):
     """ Mock httpd instance """
     httpd = MagicMock(spec=FixtureServer)
     return httpd
 
 
 @pytest.fixture
 def mock_marionette(request):
     """ Mock marionette instance """
-    marionette_class = MagicMock(spec=Marionette)
+    marionette = MagicMock(spec=Marionette())
     if 'has_crashed' in request.funcargnames:
-        marionette_class.check_for_crash.return_value = request.getfuncargvalue(
+        marionette.check_for_crash.return_value = request.getfuncargvalue(
             'has_crashed'
         )
-    return marionette_class
+    return marionette
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py
@@ -20,17 +20,17 @@ def runner(mach_parsed_kwargs):
 
 @pytest.fixture
 def mock_runner(runner, mock_marionette, monkeypatch):
     """
     MarionetteTestRunner instance with mocked-out
     self.marionette and other properties,
     to enable testing runner.run_tests().
     """
-    runner.driverclass = mock_marionette
+    runner.driverclass = Mock(return_value=mock_marionette)
     for attr in ['run_test_set', '_capabilities']:
         setattr(runner, attr, Mock())
     runner._appName = 'fake_app'
     # simulate that browser runs with e10s by default
     runner._appinfo = {'browserTabsRemoteAutostart': True}
     monkeypatch.setattr('marionette_harness.runner.base.mozversion', Mock())
     return runner