зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417920 - [python-test] Use a global pytest.ini configuration file, r=davehunt
This changes two config options: pytest_classes = PyTest # only classes that start with 'PyTest' will be considered tests (previously this was Test) xfail_strict = true # tests marked as xfail will cause pytest to return non-zero if they unexpectedly pass MozReview-Commit-ID: DCWoDFbe6Mk --HG-- extra : rebase_source : 9aa806e035d62d51bb338708396851c40f55ee00
This commit is contained in:
Родитель
1a5f8dc284
Коммит
d19095947f
|
@ -12,6 +12,8 @@ from unittest import TextTestRunner as _TestRunner, TestResult as _TestResult
|
|||
import pytest
|
||||
import six
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
StringIO = six.StringIO
|
||||
|
||||
'''Helper to make python unit tests report the way that the Mozilla
|
||||
|
@ -232,6 +234,7 @@ def main(*args, **kwargs):
|
|||
|
||||
module = __import__('__main__')
|
||||
args.extend([
|
||||
'-c', os.path.join(here, 'pytest.ini'),
|
||||
'-vv',
|
||||
'-p', 'mozlog.pytest_mozlog.plugin',
|
||||
'-p', 'no:cacheprovider',
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
[pytest]
|
||||
python_classes=PyTest
|
||||
xfail_strict=true
|
|
@ -1,2 +0,0 @@
|
|||
[pytest]
|
||||
addopts = -p no:terminalreporter
|
|
@ -89,4 +89,4 @@ def test_handler(server):
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -66,4 +66,4 @@ def test_parse_opt_args_emulator(mach_parsed_kwargs, arg_name, arg_dest, arg_val
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -107,4 +107,4 @@ def test_harness_sets_up_default_test_handlers(mach_parsed_kwargs):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -507,4 +507,4 @@ def test_option_run_until_failure(mach_parsed_kwargs, repeat, run_until_failure)
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -53,4 +53,4 @@ def test_crash_is_recorded_as_error(empty_marionette_test,
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -66,4 +66,4 @@ def test_where_is():
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
mozunit.main('--log-tbpl=-')
|
||||
mozunit.main('-p', 'no:terminalreporter', '--log-tbpl=-')
|
||||
|
|
|
@ -67,14 +67,13 @@ foo = ['A list of strings', 'that go over 80 characters', 'to test if autopep8 f
|
|||
assert fh.read() == contents
|
||||
|
||||
|
||||
@pytest.mark.xfail(
|
||||
strict=True, reason="Bug 1277851 - custom configs are ignored if specifying a parent path")
|
||||
@pytest.mark.xfail(reason="Bug 1277851 - custom configs are ignored if specifying a parent path")
|
||||
def test_lint_custom_config_from_parent_path(lint, paths):
|
||||
results = lint(paths(), collapse_results=True)
|
||||
assert paths('custom/good.py')[0] not in results
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True, reason="Bug 1277851 - 'exclude' argument is ignored")
|
||||
@pytest.mark.xfail(reason="Bug 1277851 - 'exclude' argument is ignored")
|
||||
def test_lint_excluded_file(lint, paths):
|
||||
paths = paths('bad.py')
|
||||
results = lint(paths, exclude=paths)
|
||||
|
|
Загрузка…
Ссылка в новой задаче