Bug 1347483 - blessings package should not be downloaded during mach virtualenv setup; r?mshal
This fixes a regression introduced in
Bug 1335873, which changes the mozbase
packages.txt to call mozlog's setup.py. Calling setup.py registers the
pytest_mozlog plugin for marionette-harness tests.
Instead, we can register the pytest-mozlog plugin via command-line arguments
to pytest, which are set in pytest.ini for the marionette-harness tests.
As a result, we can revert the mozbase packages.txt to not refer to mozlog's
setup.py
I'm leaving the pytest entry-point in mozlog's setup.py so that external
consumers don't have to register the pytest_mozlog plugin manually.
MozReview-Commit-ID: I5wNq5H1x3X
--- a/taskcluster/ci/source-test/python-tests.yml
+++ b/taskcluster/ci/source-test/python-tests.yml
@@ -42,17 +42,19 @@ marionette-harness:
using: mach
mach: python-test --subsuite marionette-harness
run-on-projects:
- integration
- release
when:
files-changed:
- 'testing/marionette/harness/**'
- - 'testing/mozbase/mozlog/mozlog/pytest_mozlog/**'
+ - 'testing/mozbase/mozlog/mozlog/**'
+ - 'testing/mozbase/mozlog/setup.py'
+ - 'testing/mozbase/packages.txt'
- 'python/mach_commands.py'
mozbase:
description: testing/mozbase unit tests
platform:
- linux64/opt
treeherder:
symbol: py(mb)
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/pytest.ini
@@ -0,0 +1,7 @@
+[pytest]
+# Early-load pytest_mozlog plugin to replace terminal reporter.
+# Adding pytest_mozlog plugin to conftest.py registers the plugin
+# too late for tests to recognize mozlog options.
+# This manual registration of plugin is needed for running these
+# tests in mach, whose virtualenv setup does not call mozlog's setup.py
+addopts = -p mozlog.pytest_mozlog.plugin -p no:terminalreporter
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_httpd.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_httpd.py
@@ -83,9 +83,9 @@ def test_handler(server):
body = urllib2.urlopen(url).read()
res = json.loads(body)
assert res["count"] == counter
if __name__ == "__main__":
import sys
sys.exit(pytest.main(
- ['-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_arguments.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_arguments.py
@@ -25,9 +25,9 @@ def test_parse_arg_socket_timeout(socket
else:
args = parser.parse_args(args=argv)
assert hasattr(args, 'socket_timeout') and args.socket_timeout == float(socket_timeout)
if __name__ == '__main__':
import sys
sys.exit(pytest.main(
- ['-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_harness.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_harness.py
@@ -101,9 +101,9 @@ def test_harness_sets_up_default_test_ha
mach_parsed_kwargs.pop('tests')
runner = harness._runner_class(**mach_parsed_kwargs)
assert marionette_test.MarionetteTestCase in runner.test_handlers
if __name__ == '__main__':
import sys
sys.exit(pytest.main(
- ['-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- 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
@@ -435,9 +435,9 @@ def test_e10s_option_clash_raises(mock_r
mock_runner.e10s = False
with pytest.raises(AssertionError) as e:
mock_runner.run_tests([u'test_fake_thing.py'])
assert "configuration (self.e10s) does not match browser appinfo" in e.value.message
if __name__ == '__main__':
import sys
sys.exit(pytest.main(
- ['-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_test_result.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_test_result.py
@@ -47,9 +47,9 @@ def test_crash_is_recorded_as_error(empt
assert len(result.errors) == 1
else:
assert len(result.errors) == 0
if __name__ == '__main__':
import sys
sys.exit(pytest.main(
- ['-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_serve.py
+++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_serve.py
@@ -60,9 +60,9 @@ def test_where_is():
serve.start()
assert serve.where_is("/") == serve.servers["http"][1].get_url("/")
assert serve.where_is("/", on="https") == serve.servers["https"][1].get_url("/")
if __name__ == "__main__":
import sys
sys.exit(pytest.main(
- ['-s', '-p', 'no:terminalreporter', '--log-tbpl=-', __file__]))
+ ['--log-tbpl=-', __file__]))
--- a/testing/mozbase/packages.txt
+++ b/testing/mozbase/packages.txt
@@ -3,17 +3,17 @@ mozb2g.pth:testing/mozbase/mozb2g
mozcrash.pth:testing/mozbase/mozcrash
mozdebug.pth:testing/mozbase/mozdebug
mozdevice.pth:testing/mozbase/mozdevice
mozfile.pth:testing/mozbase/mozfile
mozhttpd.pth:testing/mozbase/mozhttpd
mozinfo.pth:testing/mozbase/mozinfo
mozinstall.pth:testing/mozbase/mozinstall
mozleak.pth:testing/mozbase/mozleak
-setup.py:testing/mozbase/mozlog:develop
+mozlog.pth:testing/mozbase/mozlog
moznetwork.pth:testing/mozbase/moznetwork
mozprocess.pth:testing/mozbase/mozprocess
mozprofile.pth:testing/mozbase/mozprofile
mozrunner.pth:testing/mozbase/mozrunner
mozsystemmonitor.pth:testing/mozbase/mozsystemmonitor
mozscreenshot.pth:testing/mozbase/mozscreenshot
moztest.pth:testing/mozbase/moztest
mozversion.pth:testing/mozbase/mozversion