Commit c9b39e08 authored by Roman Yurchak's avatar Roman Yurchak

Add pytest --run-xfail run option

parent 5728cfde
...@@ -24,6 +24,9 @@ try: ...@@ -24,6 +24,9 @@ try:
group.addoption( group.addoption(
'--build-dir', action="store", default=BUILD_PATH, '--build-dir', action="store", default=BUILD_PATH,
help="Path to the build directory") help="Path to the build directory")
group.addoption(
'--run-xfail', action="store_true",
help="If provided, tests marked as xfail will be run")
except ImportError: except ImportError:
pytest = None pytest = None
......
# Test modules with a failure reason after their name are either skipped # Test modules with a failure reason after their name are either skipped
# or marked as a known failure in pytest. # or marked as a known failure in pytest.
# #
# Following reason codes are skipped, whithout running them, as they lead to # Following reason codes are skipped, as they lead to segfaults:
# segfaults:
# - segfault-<syscall>: segfault in the corresponding system call. # - segfault-<syscall>: segfault in the corresponding system call.
# #
# While the below reason codes are marked as a known failure, and are still # While the below reason codes are marked as a known failure. By default, they
# executed: # are also skipped. To run them, provide --run-xfail argument to pytest,
# - platform-specific: This is testing something about a particular platform # - platform-specific: This is testing something about a particular platform
# that isn't relevant here # that isn't relevant here
# - async: relies on async # - async: relies on async
......
...@@ -352,9 +352,13 @@ def test_cpython_core(python_test, selenium, request): ...@@ -352,9 +352,13 @@ def test_cpython_core(python_test, selenium, request):
.format(','.join(error_flags))) .format(','.join(error_flags)))
if error_flags: if error_flags:
request.applymarker(pytest.mark.xfail( if request.config.option.run_xfail:
run=False, reason='known failure with code "{}"' request.applymarker(pytest.mark.xfail(
.format(','.join(error_flags)))) run=False, reason='known failure with code "{}"'
.format(','.join(error_flags))))
else:
pytest.xfail('known failure with code "{}"'
.format(','.join(error_flags)))
selenium.load_package('test') selenium.load_package('test')
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment