Skip to content

Commit 72d06e6

Browse files
authored
Merge pull request #6539 from blueyed/merge-master-into-features
Merge master into features
2 parents 0bf9628 + aca1723 commit 72d06e6

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

src/_pytest/pytester.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,8 @@ class Testdir:
527527
528528
"""
529529

530+
__test__ = False
531+
530532
CLOSE_STDIN = object
531533

532534
class TimeoutExpired(Exception):

testing/test_pytester.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from _pytest.pytester import LineMatcher
1717
from _pytest.pytester import SysModulesSnapshot
1818
from _pytest.pytester import SysPathsSnapshot
19+
from _pytest.pytester import Testdir
1920

2021

2122
def test_make_hook_recorder(testdir) -> None:
@@ -273,7 +274,8 @@ def test_assert_outcomes_after_pytest_error(testdir) -> None:
273274
result.assert_outcomes(passed=0)
274275

275276

276-
def test_cwd_snapshot(tmpdir) -> None:
277+
def test_cwd_snapshot(testdir: Testdir) -> None:
278+
tmpdir = testdir.tmpdir
277279
foo = tmpdir.ensure("foo", dir=1)
278280
bar = tmpdir.ensure("bar", dir=1)
279281
foo.chdir()

testing/test_runner.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ def test_outcomeexception_passes_except_Exception() -> None:
557557
try:
558558
raise outcomes.OutcomeException("test")
559559
except Exception:
560-
pass
560+
raise NotImplementedError()
561561

562562

563563
def test_pytest_exit() -> None:
@@ -740,8 +740,9 @@ def f():
740740
mod2 = pytest.importorskip("hello123", minversion="1.3")
741741
assert mod2 == mod
742742
except Skipped:
743-
print(_pytest._code.ExceptionInfo.from_current())
744-
pytest.fail("spurious skip")
743+
raise NotImplementedError(
744+
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current())
745+
)
745746

746747

747748
def test_importorskip_imports_last_module_part() -> None:
@@ -759,8 +760,9 @@ def test_importorskip_dev_module(monkeypatch) -> None:
759760
with pytest.raises(Skipped):
760761
pytest.importorskip("mockmodule1", minversion="0.14.0")
761762
except Skipped:
762-
print(_pytest._code.ExceptionInfo.from_current())
763-
pytest.fail("spurious skip")
763+
raise NotImplementedError(
764+
"spurious skip: {}".format(_pytest._code.ExceptionInfo.from_current())
765+
)
764766

765767

766768
def test_importorskip_module_level(testdir) -> None:
@@ -1030,7 +1032,7 @@ def test_outcome_exception_bad_msg() -> None:
10301032
"""Check that OutcomeExceptions validate their input to prevent confusing errors (#5578)"""
10311033

10321034
def func() -> None:
1033-
pass
1035+
raise NotImplementedError()
10341036

10351037
expected = (
10361038
"OutcomeException expected string as 'msg' parameter, got 'function' instead.\n"

0 commit comments

Comments
 (0)