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_monkeypatch.py
testing/test_monkeypatch.py
112
test_setitem
def
function
def test_setitem() -> None: d = {"x": 1} monkeypatch = MonkeyPatch() monkeypatch.setitem(d, "x", 2) monkeypatch.setitem(d, "y", 1700) monkeypatch.setitem(d, "y", 1700) assert d["x"] == 2 assert d["y"] == 1700 monkeypatch.setitem(d, "x", 3) assert d["x"] == 3 monkeypatch.undo() ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
114
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
115
setitem
ref
function
monkeypatch.setitem(d, "x", 2)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
116
setitem
ref
function
monkeypatch.setitem(d, "y", 1700)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
117
setitem
ref
function
monkeypatch.setitem(d, "y", 1700)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
120
setitem
ref
function
monkeypatch.setitem(d, "x", 3)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
122
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
126
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
130
test_setitem_deleted_meanwhile
def
function
def test_setitem_deleted_meanwhile() -> None: d: Dict[str, object] = {} monkeypatch = MonkeyPatch() monkeypatch.setitem(d, "x", 2) del d["x"] monkeypatch.undo() assert not d
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
132
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
133
setitem
ref
function
monkeypatch.setitem(d, "x", 2)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
135
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
139
parametrize
ref
function
@pytest.mark.parametrize("before", [True, False])
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
140
test_setenv_deleted_meanwhile
def
function
def test_setenv_deleted_meanwhile(before: bool) -> None: key = "qwpeoip123" if before: os.environ[key] = "world" monkeypatch = MonkeyPatch() monkeypatch.setenv(key, "hello") del os.environ[key] monkeypatch.undo() if before: assert os.environ[key] == "world" del os.env...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
144
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
145
setenv
ref
function
monkeypatch.setenv(key, "hello")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
147
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
155
test_delitem
def
function
def test_delitem() -> None: d: Dict[str, object] = {"x": 1} monkeypatch = MonkeyPatch() monkeypatch.delitem(d, "x") assert "x" not in d monkeypatch.delitem(d, "y", raising=_False) pytest.raises(KeyError, monkeypatch.delitem, d, "y") assert not d monkeypatch.setitem(d, "y", 1700) asse...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
157
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
158
delitem
ref
function
monkeypatch.delitem(d, "x")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
160
delitem
ref
function
monkeypatch.delitem(d, "y", raising=False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
161
raises
ref
function
pytest.raises(KeyError, monkeypatch.delitem, d, "y")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
163
setitem
ref
function
monkeypatch.setitem(d, "y", 1700)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
166
setitem
ref
function
monkeypatch.setitem(d, "x", 1500)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
168
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
172
test_setenv
def
function
def test_setenv() -> None: monkeypatch = MonkeyPatch() with pytest.warns(pytest.PytestWarning): monkeypatch.setenv("XYZ123", 2) # type: ignore[arg-type] import os assert os.environ["XYZ123"] == "2" monkeypatch.undo() assert "XYZ123" not in os.environ
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
173
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
174
warns
ref
function
with pytest.warns(pytest.PytestWarning):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
175
setenv
ref
function
monkeypatch.setenv("XYZ123", 2) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
179
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
183
test_delenv
def
function
def test_delenv() -> None: name = "xyz1234" assert name not in os.environ monkeypatch = MonkeyPatch() pytest.raises(KeyError, monkeypatch.delenv, name, raising=_True) monkeypatch.delenv(name, raising=_False) monkeypatch.undo() os.environ[name] = "1" try: monkeypatch = MonkeyPatch...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
186
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
187
raises
ref
function
pytest.raises(KeyError, monkeypatch.delenv, name, raising=True)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
188
delenv
ref
function
monkeypatch.delenv(name, raising=False)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
189
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
192
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
193
delenv
ref
function
monkeypatch.delenv(name)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
195
setenv
ref
function
monkeypatch.setenv(name, "3")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
197
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
204
TestEnvironWarnings
def
class
test_setenv_non_str_warning
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
213
test_setenv_non_str_warning
def
function
def test_setenv_non_str_warning(self, monkeypatch: MonkeyPatch) -> None: value = 2 msg = ( "Value of environment variable PYTEST_INTERNAL_MY_VAR type should be str, " "but got 2 (type: int); converted to str implicitly" ) with pytest.warns(pytest.PytestWarning...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
219
warns
ref
function
with pytest.warns(pytest.PytestWarning, match=re.escape(msg)):
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
220
setenv
ref
function
monkeypatch.setenv(str(self.VAR_NAME), value) # type: ignore[arg-type]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
223
test_setenv_prepend
def
function
def test_setenv_prepend() -> None: import os monkeypatch = MonkeyPatch() monkeypatch.setenv("XYZ123", "2", prepend="-") monkeypatch.setenv("XYZ123", "3", prepend="-") assert os.environ["XYZ123"] == "3-2" monkeypatch.undo() assert "XYZ123" not in os.environ
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
226
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
227
setenv
ref
function
monkeypatch.setenv("XYZ123", "2", prepend="-")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
228
setenv
ref
function
monkeypatch.setenv("XYZ123", "3", prepend="-")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
230
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
234
test_monkeypatch_plugin
def
function
def test_monkeypatch_plugin(pytester: Pytester) -> None: reprec = pytester.inline_runsource( """ def test_method(monkeypatch): assert monkeypatch.__class__.__name__ == "MonkeyPatch" """ ) res = reprec.countoutcomes() assert tuple(res) == (1, 0, 0), res
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
235
inline_runsource
ref
function
reprec = pytester.inline_runsource(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
241
countoutcomes
ref
function
res = reprec.countoutcomes()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
245
test_syspath_prepend
def
function
def test_syspath_prepend(mp: MonkeyPatch) -> None: old = list(sys.path) mp.syspath_prepend("world") mp.syspath_prepend("hello") assert sys.path[0] == "hello" assert sys.path[1] == "world" mp.undo() assert sys.path == old mp.undo() assert sys.path == old
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
247
syspath_prepend
ref
function
mp.syspath_prepend("world")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
248
syspath_prepend
ref
function
mp.syspath_prepend("hello")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
251
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
253
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
257
test_syspath_prepend_double_undo
def
function
def test_syspath_prepend_double_undo(mp: MonkeyPatch) -> None: old_syspath = sys.path[:] try: mp.syspath_prepend("hello world") mp.undo() sys.path.append("more hello world") mp.undo() assert sys.path[-1] == "more hello world" finally: sys.path[:] = old_syspath...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
260
syspath_prepend
ref
function
mp.syspath_prepend("hello world")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
261
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
263
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
269
test_chdir_with_path_local
def
function
def test_chdir_with_path_local(mp: MonkeyPatch, tmp_path: Path) -> None: mp.chdir(tmp_path) assert os.getcwd() == str(tmp_path)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
274
test_chdir_with_str
def
function
def test_chdir_with_str(mp: MonkeyPatch, tmp_path: Path) -> None: mp.chdir(str(tmp_path)) assert os.getcwd() == str(tmp_path)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
279
test_chdir_undo
def
function
def test_chdir_undo(mp: MonkeyPatch, tmp_path: Path) -> None: cwd = os.getcwd() mp.chdir(tmp_path) mp.undo() assert os.getcwd() == cwd
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
282
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
286
test_chdir_double_undo
def
function
def test_chdir_double_undo(mp: MonkeyPatch, tmp_path: Path) -> None: mp.chdir(str(tmp_path)) mp.undo() os.chdir(tmp_path) mp.undo() assert os.getcwd() == str(tmp_path)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
288
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
290
undo
ref
function
mp.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
294
test_issue185_time_breaks
def
function
def test_issue185_time_breaks(pytester: Pytester) -> None: pytester.makepyfile( """ import time def test_m(monkeypatch): def f(): raise Exception monkeypatch.setattr(time, "time", f) """ ) result = pytester.runpytest() result.stdout.fnm...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
295
makepyfile
ref
function
pytester.makepyfile(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
304
runpytest
ref
function
result = pytester.runpytest()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
305
fnmatch_lines
ref
function
result.stdout.fnmatch_lines(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
312
test_importerror
def
function
def test_importerror(pytester: Pytester) -> None: p = pytester.mkpydir("package") p.joinpath("a.py").write_text( textwrap.dedent( """\ import doesnotexist x = 1 """ ) ) pytester.path.joinpath("test_importerror.py").write_text( textwrap.dedent( ...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
313
mkpydir
ref
function
p = pytester.mkpydir("package")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
331
runpytest
ref
function
result = pytester.runpytest()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
332
fnmatch_lines
ref
function
result.stdout.fnmatch_lines(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
339
Sample
def
class
hello
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
341
hello
def
function
def hello() -> bool: return _True
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
345
SampleInherit
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
349
parametrize
ref
function
@pytest.mark.parametrize(
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
354
test_issue156_undo_staticmethod
def
function
def test_issue156_undo_staticmethod(Sample: Type[Sample]) -> None: monkeypatch = MonkeyPatch() monkeypatch.setattr(Sample, "hello", None) assert Sample.hello is None monkeypatch.undo() # type: ignore[unreachable] assert Sample.hello()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
355
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
360
undo
ref
function
monkeypatch.undo() # type: ignore[unreachable]
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
361
hello
ref
function
assert Sample.hello()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
364
test_undo_class_descriptors_delattr
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
365
SampleParent
def
class
hello world
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
367
hello
def
function
def hello(_cls): pass @staticmethod def world(): pass class SampleChild(SampleParent): pass monkeypatch = MonkeyPatch() original_hello = SampleChild.hello original_world = SampleChild.world monkeypatch.delattr(SampleParent, "hello") mon...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
371
world
def
function
def world(): pass class SampleChild(SampleParent): pass monkeypatch = MonkeyPatch() original_hello = SampleChild.hello original_world = SampleChild.world monkeypatch.delattr(SampleParent, "hello") monkeypatch.delattr(SampleParent, "world") assert getattr(Sample...
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
374
SampleChild
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
377
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
386
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
391
test_issue1338_name_resolving
def
function
def test_issue1338_name_resolving() -> None: pytest.importorskip("requests") monkeypatch = MonkeyPatch() try: monkeypatch.delattr("requests.sessions.Session.request") finally: monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
392
importorskip
ref
function
pytest.importorskip("requests")
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
393
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
397
undo
ref
function
monkeypatch.undo()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
400
test_context
def
function
def test_context() -> None: monkeypatch = MonkeyPatch() import functools import inspect with monkeypatch.context() as m: m.setattr(functools, "partial", 3) assert not inspect.isclass(functools.partial) assert inspect.isclass(functools.partial)
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
401
MonkeyPatch
ref
function
monkeypatch = MonkeyPatch()
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
406
context
ref
function
with monkeypatch.context() as m:
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
412
test_context_classmethod
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
413
A
def
class
playground/5d9c10a9-c67f-4d61-a0f0-c84c5a279fa1/pytest/testing/test_monkeypatch.py
testing/test_monkeypatch.py
416
context
ref
function
with MonkeyPatch.context() as m: