fname
stringlengths
63
176
rel_fname
stringclasses
706 values
line
int64
-1
4.5k
name
stringlengths
1
81
kind
stringclasses
2 values
category
stringclasses
2 values
info
stringlengths
0
77.9k
⌀
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
49
test_one_dir
def
function
def test_one_dir(pytester: Pytester, file_structure) -> None: pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub\n") result = pytester.runpytest("test_foo.py") assert result.ret == 0 result.assert_outcomes(passed=1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
50
makefile
ref
function
pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub\n")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
51
runpytest
ref
function
result = pytester.runpytest("test_foo.py")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
53
assert_outcomes
ref
function
result.assert_outcomes(passed=1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
56
test_two_dirs
def
function
def test_two_dirs(pytester: Pytester, file_structure) -> None: pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub sub2\n") result = pytester.runpytest("test_foo.py", "test_bar.py") assert result.ret == 0 result.assert_outcomes(passed=2)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
57
makefile
ref
function
pytester.makefile(".ini", pytest="[pytest]\npythonpath=sub sub2\n")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
58
runpytest
ref
function
result = pytester.runpytest("test_foo.py", "test_bar.py")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
60
assert_outcomes
ref
function
result.assert_outcomes(passed=2)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
63
test_module_not_found
def
function
def test_module_not_found(pytester: Pytester, file_structure) -> None: """Without the pythonpath setting, the module should not be found.""" pytester.makefile(".ini", pytest="[pytest]\n") result = pytester.runpytest("test_foo.py") assert result.ret == pytest.ExitCode.INTERRUPTED result.assert_outcom...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
65
makefile
ref
function
pytester.makefile(".ini", pytest="[pytest]\n")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
66
runpytest
ref
function
result = pytester.runpytest("test_foo.py")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
68
assert_outcomes
ref
function
result.assert_outcomes(errors=1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
70
fnmatch_lines
ref
function
result.stdout.fnmatch_lines([expected_error])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
73
test_no_ini
def
function
def test_no_ini(pytester: Pytester, file_structure) -> None: """If no ini file, test should error.""" result = pytester.runpytest("test_foo.py") assert result.ret == pytest.ExitCode.INTERRUPTED result.assert_outcomes(errors=1) expected_error = "E ModuleNotFoundError: No module named 'foo'" res...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
75
runpytest
ref
function
result = pytester.runpytest("test_foo.py")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
77
assert_outcomes
ref
function
result.assert_outcomes(errors=1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
79
fnmatch_lines
ref
function
result.stdout.fnmatch_lines([expected_error])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
82
test_clean_up
def
function
def test_clean_up(pytester: Pytester) -> None: """Test that the pythonpath plugin cleans up after itself.""" # This is tough to test behaviorly because the cleanup really runs last. # So the test make several implementation assumptions: # - Cleanup is done in pytest_unconfigure(). # - Not a hookwrap...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
89
makefile
ref
function
pytester.makefile(".ini", pytest="[pytest]\npythonpath=I_SHALL_BE_REMOVED\n")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
90
makepyfile
ref
function
pytester.makepyfile(test_foo="""def test_foo(): pass""")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
95
Plugin
def
class
pytest_unconfigure
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
96
hookimpl
ref
function
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
97
pytest_unconfigure
def
function
def pytest_unconfigure(self) -> Generator[None, None, None]: nonlocal before, after before = sys.path.copy() yield after = sys.path.copy() result = pytester.runpytest_inprocess(plugins=[Plugin()]) assert result.ret == 0 assert before is not None ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
103
runpytest_inprocess
ref
function
result = pytester.runpytest_inprocess(plugins=[Plugin()])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_pythonpath.py
testing/test_pythonpath.py
103
Plugin
ref
function
result = pytester.runpytest_inprocess(plugins=[Plugin()])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
9
test_recwarn_stacklevel
def
function
def test_recwarn_stacklevel(recwarn: WarningsRecorder) -> None: warnings.warn("hello") warn = recwarn.pop() assert warn.filename == __file__
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
15
test_recwarn_functional
def
function
def test_recwarn_functional(pytester: Pytester) -> None: pytester.makepyfile( """ import warnings def test_method(recwarn): warnings.warn("hello") warn = recwarn.pop() assert isinstance(warn.message, UserWarning) """ ) reprec = pytester.inline_...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
16
makepyfile
ref
function
pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
25
inline_run
ref
function
reprec = pytester.inline_run()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
26
assertoutcome
ref
function
reprec.assertoutcome(passed=1)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
30
test_recwarn_captures_deprecation_warning
def
function
def test_recwarn_captures_deprecation_warning(recwarn: WarningsRecorder) -> None: """ Check that recwarn can capture DeprecationWarning by default without custom filterwarnings (see #8666). """ warnings.warn(DeprecationWarning("some deprecation")) assert len(recwarn) == 1 assert recwarn.pop(...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
40
TestWarningsRecorderChecker
def
class
test_recording test_warn_stacklevel test_typechecking test_invalid_enter_exit
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
41
test_recording
def
function
def test_recording(self) -> None: rec = WarningsRecorder(_ispytest=_True) with rec: assert not rec.list warnings.warn_explicit("hello", UserWarning, "xyz", 13) assert len(rec.list) == 1 warnings.warn(DeprecationWarning("hello")) assert len(...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
42
WarningsRecorder
ref
function
rec = WarningsRecorder(_ispytest=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
55
raises
ref
function
pytest.raises(AssertionError, rec.pop)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
57
test_warn_stacklevel
def
function
def test_warn_stacklevel(self) -> None: """#4243""" rec = WarningsRecorder(_ispytest=_True) with rec: warnings.warn("test", DeprecationWarning, 2) def test_typechecking(self) -> None: from _pytest.recwarn import WarningsChecker with pytest.raises(TypeError):...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
59
WarningsRecorder
ref
function
rec = WarningsRecorder(_ispytest=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
63
test_typechecking
def
function
def test_typechecking(self) -> None: from _pytest.recwarn import WarningsChecker with pytest.raises(TypeError): WarningsChecker(5, _ispytest=_True) # type: ignore[arg-type] with pytest.raises(TypeError): WarningsChecker(("hi", RuntimeWarning), _ispytest=_True) # ty...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
66
raises
ref
function
with pytest.raises(TypeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
67
WarningsChecker
ref
function
WarningsChecker(5, _ispytest=True) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
68
raises
ref
function
with pytest.raises(TypeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
69
WarningsChecker
ref
function
WarningsChecker(("hi", RuntimeWarning), _ispytest=True) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
70
raises
ref
function
with pytest.raises(TypeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
71
WarningsChecker
ref
function
WarningsChecker([DeprecationWarning, RuntimeWarning], _ispytest=True) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
73
test_invalid_enter_exit
def
function
def test_invalid_enter_exit(self) -> None: # wrap this test in WarningsRecorder to ensure warning state gets reset with WarningsRecorder(_ispytest=_True): with pytest.raises(RuntimeError): rec = WarningsRecorder(_ispytest=_True) rec.__exit__(None, None, No...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
75
WarningsRecorder
ref
function
with WarningsRecorder(_ispytest=True):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
76
raises
ref
function
with pytest.raises(RuntimeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
77
WarningsRecorder
ref
function
rec = WarningsRecorder(_ispytest=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
78
__exit__
ref
function
rec.__exit__(None, None, None) # can't exit before entering
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
80
raises
ref
function
with pytest.raises(RuntimeError):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
81
WarningsRecorder
ref
function
rec = WarningsRecorder(_ispytest=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
87
TestDeprecatedCall
def
class
dep dep_explicit test_deprecated_call_raises test_deprecated_call test_deprecated_call_ret test_deprecated_call_preserves test_deprecated_explicit_call_raises test_deprecated_explicit_call test_deprecated_call_no_warning test_deprecated_call_modes test_deprecated_call_exception_is_raised test_deprecated_call_specificit...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
90
dep
def
function
def dep(self, i: int, j: Optional[int] = None) -> int: if i == 0: warnings.warn("is deprecated", DeprecationWarning, stacklevel=1) return 42 def dep_explicit(self, i: int) -> None: if i == 0: warnings.warn_explicit( "dep_explicit", category=Deprec...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
95
dep_explicit
def
function
def dep_explicit(self, i: int) -> None: if i == 0: warnings.warn_explicit( "dep_explicit", category=DeprecationWarning, filename="hello", lineno=3 ) def test_deprecated_call_raises(self) -> None: with pytest.raises(pytest.fail.Exception, match="No warning...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
101
test_deprecated_call_raises
def
function
def test_deprecated_call_raises(self) -> None: with pytest.raises(pytest.fail.Exception, match="No warnings of type"): pytest.deprecated_call(self.dep, 3, 5) def test_deprecated_call(self) -> None: pytest.deprecated_call(self.dep, 0, 5) def test_deprecated_call_ret(self) -> Non...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
102
raises
ref
function
with pytest.raises(pytest.fail.Exception, match="No warnings of type"):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
103
deprecated_call
ref
function
pytest.deprecated_call(self.dep, 3, 5)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
105
test_deprecated_call
def
function
def test_deprecated_call(self) -> None: pytest.deprecated_call(self.dep, 0, 5) def test_deprecated_call_ret(self) -> None: ret = pytest.deprecated_call(self.dep, 0) assert ret == 42 def test_deprecated_call_preserves(self) -> None: # Type ignored because `onceregistry` and ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
106
deprecated_call
ref
function
pytest.deprecated_call(self.dep, 0, 5)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
108
test_deprecated_call_ret
def
function
def test_deprecated_call_ret(self) -> None: ret = pytest.deprecated_call(self.dep, 0) assert ret == 42 def test_deprecated_call_preserves(self) -> None: # Type ignored because `onceregistry` and `filters` are not # documented API. onceregistry = warnings.onceregistry.cop...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
109
deprecated_call
ref
function
ret = pytest.deprecated_call(self.dep, 0)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
112
test_deprecated_call_preserves
def
function
def test_deprecated_call_preserves(self) -> None: # Type ignored because `onceregistry` and `filters` are not # documented API. onceregistry = warnings.onceregistry.copy() # type: ignore filters = warnings.filters[:] # type: ignore warn = warnings.warn warn_explicit...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
119
test_deprecated_call_raises
ref
function
self.test_deprecated_call_raises()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
120
test_deprecated_call
ref
function
self.test_deprecated_call()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
126
test_deprecated_explicit_call_raises
def
function
def test_deprecated_explicit_call_raises(self) -> None: with pytest.raises(pytest.fail.Exception): pytest.deprecated_call(self.dep_explicit, 3) def test_deprecated_explicit_call(self) -> None: pytest.deprecated_call(self.dep_explicit, 0) pytest.deprecated_call(self.dep_expli...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
127
raises
ref
function
with pytest.raises(pytest.fail.Exception):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
128
deprecated_call
ref
function
pytest.deprecated_call(self.dep_explicit, 3)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
130
test_deprecated_explicit_call
def
function
def test_deprecated_explicit_call(self) -> None: pytest.deprecated_call(self.dep_explicit, 0) pytest.deprecated_call(self.dep_explicit, 0) @pytest.mark.parametrize("mode", ["context_manager", "call"]) def test_deprecated_call_no_warning(self, mode) -> None: """Ensure deprecated_call...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
131
deprecated_call
ref
function
pytest.deprecated_call(self.dep_explicit, 0)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
132
deprecated_call
ref
function
pytest.deprecated_call(self.dep_explicit, 0)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
134
parametrize
ref
function
@pytest.mark.parametrize("mode", ["context_manager", "call"])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
135
test_deprecated_call_no_warning
def
function
def test_deprecated_call_no_warning(self, mode) -> None: """Ensure deprecated_call() raises the expected failure when its block/function does not raise a deprecation warning. """ def f(): pass msg = "No warnings of type (.*DeprecationWarning.*, .*PendingDeprecat...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
140
f
def
function
def f(): pass msg = "No warnings of type (.*DeprecationWarning.*, .*PendingDeprecationWarning.*)" with pytest.raises(pytest.fail.Exception, match=msg): if mode == "call": pytest.deprecated_call(f) else: with pytest.deprecated_c...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
144
raises
ref
function
with pytest.raises(pytest.fail.Exception, match=msg):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
146
deprecated_call
ref
function
pytest.deprecated_call(f)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
148
deprecated_call
ref
function
with pytest.deprecated_call():
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
149
f
ref
function
f()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
151
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
154
parametrize
ref
function
@pytest.mark.parametrize("mode", ["context_manager", "call"])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
155
parametrize
ref
function
@pytest.mark.parametrize("call_f_first", [True, False])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
157
test_deprecated_call_modes
def
function
def test_deprecated_call_modes(self, warning_type, mode, call_f_first) -> None: """Ensure deprecated_call() captures a deprecation warning as expected inside its block/function. """ def f(): warnings.warn(warning_type("hi")) return 10 # ensure deprec...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
162
f
def
function
def f(): pass msg = "No warnings of type (.*DeprecationWarning.*, .*PendingDeprecationWarning.*)" with pytest.raises(pytest.fail.Exception, match=msg): if mode == "call": pytest.deprecated_call(f) else: with pytest.deprecated_c...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
163
warning_type
ref
function
warnings.warn(warning_type("hi"))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
168
f
ref
function
assert f() == 10
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
170
deprecated_call
ref
function
assert pytest.deprecated_call(f) == 10
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
172
deprecated_call
ref
function
with pytest.deprecated_call():
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
173
f
ref
function
assert f() == 10
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
175
parametrize
ref
function
@pytest.mark.parametrize("mode", ["context_manager", "call"])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
176
test_deprecated_call_exception_is_raised
def
function
def test_deprecated_call_exception_is_raised(self, mode) -> None: """If the block of the code being tested by deprecated_call() raises an exception, it must raise the exception undisturbed. """ def f(): raise ValueError("some exception") with pytest.raises(Value...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
181
f
def
function
def f(): pass msg = "No warnings of type (.*DeprecationWarning.*, .*PendingDeprecationWarning.*)" with pytest.raises(pytest.fail.Exception, match=msg): if mode == "call": pytest.deprecated_call(f) else: with pytest.deprecated_c...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
184
raises
ref
function
with pytest.raises(ValueError, match="some exception"):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
186
deprecated_call
ref
function
pytest.deprecated_call(f)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
188
deprecated_call
ref
function
with pytest.deprecated_call():
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
189
f
ref
function
f()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
191
test_deprecated_call_specificity
def
function
def test_deprecated_call_specificity(self) -> None: other_warnings = [ Warning, UserWarning, SyntaxWarning, RuntimeWarning, FutureWarning, ImportWarning, UnicodeWarning, ] for warning in other_warnings: ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
203
f
def
function
def f(): warnings.warn(warning("hi")) with pytest.raises(pytest.fail.Exception): pytest.deprecated_call(f) with pytest.raises(pytest.fail.Exception): with pytest.deprecated_call(): f() def test_deprecated_call_...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
204
warning
ref
function
warnings.warn(warning("hi"))
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
206
raises
ref
function
with pytest.raises(pytest.fail.Exception):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
207
deprecated_call
ref
function
pytest.deprecated_call(f)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_recwarn.py
testing/test_recwarn.py
208
raises
ref
function
with pytest.raises(pytest.fail.Exception):