Bug 1285299 - [TEMP] Add test_logging.py to test Mn-h logging;
(This is a temporary commit to test the functionality of
previous commits in this patch series. It is for review
purposes only and should be dropped before landing.)
Add a test module `test_logging.py` to the Marionette harness
unit tests, for testing the log output of Mn-h on Treeherder
using the new pytest_mozlog plugin.
MozReview-Commit-ID: 4ZpI378bZQR
new file mode 100644
--- /dev/null
+++ b/testing/marionette/harness/marionette/tests/harness_unit/test_logging.py
@@ -0,0 +1,74 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+import pytest
+
+
+def test_sample_test_pass():
+ assert True
+
+
+def test_sample_test_fail():
+ x = 5
+ assert x == 10
+
+
+def test_sample_test_exception():
+ notathing
+ assert True
+
+
+@pytest.mark.skip(reason="skipping passing test")
+def test_sample_skip_pass():
+ assert True
+
+
+@pytest.mark.skip(reason="skipping failing test")
+def test_sample_skip_fail():
+ assert False
+
+
+@pytest.mark.skip
+def test_sample_unconditional_skip():
+ assert False
+
+
+@pytest.mark.skipif(True, reason="skipping on condition")
+def test_sample_skipif():
+ assert False
+
+
+@pytest.mark.xfail
+def test_sample_expected_fail():
+ x = 5
+ assert x == 10
+
+
+@pytest.mark.xfail
+def test_sample_unexpected_pass():
+ assert True
+
+
+@pytest.fixture()
+def bad_fixture():
+ raise Exception("Faulty pytest fixture")
+ return True
+
+
+def test_setup_error(bad_fixture):
+ assert bad_fixture
+
+
+if __name__ == '__main__':
+ import sys
+ import os
+ log_filename_root = os.path.join(os.path.dirname(__file__), 'logs/test_logging_log')
+ # Uses pytest-mozlog plugin defined in conftest.py for `--log-` options
+ sys.exit(pytest.main(['--verbose', '-s', __file__]))
+ # sys.exit(pytest.main(['-p', 'no:terminalreporter', '--log-tbpl', '-',
+ # '--verbose',
+ # __file__,
+ # '--log-raw', log_filename_root + '.raw',
+ # '--log-tbpl', log_filename_root + '.tbpl',
+ # '--log-mach', log_filename_root + '.mach',
+ # ]))