tests: test_xfail_handling: use sys.dont_write_bytecode
This commit is contained in:
parent
622995a501
commit
a136111dcc
|
@ -167,11 +167,13 @@ def test_stop_on_collection_errors(broken_testdir, broken_first):
|
||||||
result.stdout.fnmatch_lines("*error during collection*")
|
result.stdout.fnmatch_lines("*error during collection*")
|
||||||
|
|
||||||
|
|
||||||
def test_xfail_handling(testdir):
|
def test_xfail_handling(testdir, monkeypatch):
|
||||||
"""Ensure normal xfail is ignored, and strict xfail interrupts the session in sw mode
|
"""Ensure normal xfail is ignored, and strict xfail interrupts the session in sw mode
|
||||||
|
|
||||||
(#5547)
|
(#5547)
|
||||||
"""
|
"""
|
||||||
|
monkeypatch.setattr("sys.dont_write_bytecode", True)
|
||||||
|
|
||||||
contents = """
|
contents = """
|
||||||
import pytest
|
import pytest
|
||||||
def test_a(): pass
|
def test_a(): pass
|
||||||
|
@ -205,10 +207,6 @@ def test_xfail_handling(testdir):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
# because we are writing to the same file, mtime might not be affected enough to
|
|
||||||
# invalidate the cache, making this next run flaky
|
|
||||||
if testdir.tmpdir.join("__pycache__").exists():
|
|
||||||
testdir.tmpdir.join("__pycache__").remove()
|
|
||||||
testdir.makepyfile(contents.format(assert_value="0", strict="True"))
|
testdir.makepyfile(contents.format(assert_value="0", strict="True"))
|
||||||
result = testdir.runpytest("--sw", "-v")
|
result = testdir.runpytest("--sw", "-v")
|
||||||
result.stdout.fnmatch_lines(
|
result.stdout.fnmatch_lines(
|
||||||
|
|
Loading…
Reference in New Issue