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/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
73
pytest_runtest_logreport
ref
function
recorder.hook.pytest_runtest_logreport(report=rep3) # type: ignore[attr-defined]
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
74
raises
ref
function
pytest.raises(ValueError, recorder.getfailures)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
77
test_parseconfig
def
function
def test_parseconfig(pytester: Pytester) -> None: config1 = pytester.parseconfig() config2 = pytester.parseconfig() assert config2 is not config1
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
78
parseconfig
ref
function
config1 = pytester.parseconfig()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
79
parseconfig
ref
function
config2 = pytester.parseconfig()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
83
test_pytester_runs_with_plugin
def
function
def test_pytester_runs_with_plugin(pytester: Pytester) -> None: pytester.makepyfile( """ pytest_plugins = "pytester" def test_hello(pytester): assert 1 """ ) result = pytester.runpytest() result.assert_outcomes(passed=1)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
84
makepyfile
ref
function
pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
91
runpytest
ref
function
result = pytester.runpytest()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
92
assert_outcomes
ref
function
result.assert_outcomes(passed=1)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
95
test_pytester_with_doctest
def
function
def test_pytester_with_doctest(pytester: Pytester) -> None: """Check that pytester can be used within doctests. It used to use `request.function`, which is `None` with doctests.""" pytester.makepyfile( **{ "sub/t-doctest.py": """ ''' >>> import os >>> pytester = ...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
99
makepyfile
ref
function
pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
112
runpytest
ref
function
result = pytester.runpytest(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
118
test_runresult_assertion_on_xfail
def
function
def test_runresult_assertion_on_xfail(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest pytest_plugins = "pytester" @pytest.mark.xfail def test_potato(): assert _False """ ) result = pytester.runpytest() result.assert_outcomes(x...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
119
makepyfile
ref
function
pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
130
runpytest
ref
function
result = pytester.runpytest()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
131
assert_outcomes
ref
function
result.assert_outcomes(xfailed=1)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
135
test_runresult_assertion_on_xpassed
def
function
def test_runresult_assertion_on_xpassed(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest pytest_plugins = "pytester" @pytest.mark.xfail def test_potato(): assert _True """ ) result = pytester.runpytest() result.assert_outcomes(...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
136
makepyfile
ref
function
pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
147
runpytest
ref
function
result = pytester.runpytest()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
148
assert_outcomes
ref
function
result.assert_outcomes(xpassed=1)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
152
test_xpassed_with_strict_is_considered_a_failure
def
function
def test_xpassed_with_strict_is_considered_a_failure(pytester: Pytester) -> None: pytester.makepyfile( """ import pytest pytest_plugins = "pytester" @pytest.mark.xfail(strict=_True) def test_potato(): assert _True """ ) result = pytester.runpytest() ...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
153
makepyfile
ref
function
pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
164
runpytest
ref
function
result = pytester.runpytest()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
165
assert_outcomes
ref
function
result.assert_outcomes(failed=1)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
169
make_holder
def
function
def make_holder(): class apiclass: def pytest_xyz(self, arg): """X""" def pytest_xyz_noarg(self): """X""" apimod = type(os)("api") def pytest_xyz(arg): """X""" def pytest_xyz_noarg(): """X""" apimod.pytest_xyz = pytest_xyz # type: ignore ...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
170
apiclass
def
class
pytest_xyz pytest_xyz_noarg
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
171
pytest_xyz
def
function
def pytest_xyz(self, arg): """X""" def pytest_xyz_noarg(self): """X""" apimod = type(os)("api") def pytest_xyz(arg): """X""" def pytest_xyz_noarg(): """X""" apimod.pytest_xyz = pytest_xyz # type: ignore apimod.pytest_xyz_noarg = pytest_xy...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
174
pytest_xyz_noarg
def
function
def pytest_xyz_noarg(self): """X""" apimod = type(os)("api") def pytest_xyz(arg): """X""" def pytest_xyz_noarg(): """X""" apimod.pytest_xyz = pytest_xyz # type: ignore apimod.pytest_xyz_noarg = pytest_xyz_noarg # type: ignore return apiclass, apimod
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
179
pytest_xyz
def
function
def pytest_xyz(arg): """X""" def pytest_xyz_noarg(): """X""" apimod.pytest_xyz = pytest_xyz # type: ignore apimod.pytest_xyz_noarg = pytest_xyz_noarg # type: ignore return apiclass, apimod
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
182
pytest_xyz_noarg
def
function
def pytest_xyz_noarg(): """X""" apimod.pytest_xyz = pytest_xyz # type: ignore apimod.pytest_xyz_noarg = pytest_xyz_noarg # type: ignore return apiclass, apimod
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
190
parametrize
ref
function
@pytest.mark.parametrize("holder", make_holder())
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
190
make_holder
ref
function
@pytest.mark.parametrize("holder", make_holder())
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
191
test_hookrecorder_basic
def
function
def test_hookrecorder_basic(holder) -> None: pm = PytestPluginManager() pm.add_hookspecs(holder) rec = HookRecorder(pm) pm.hook.pytest_xyz(arg=123) call = rec.popcall("pytest_xyz") assert call.arg == 123 assert call._name == "pytest_xyz" pytest.raises(pytest.fail.Exception, rec.popcall, ...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
192
PytestPluginManager
ref
function
pm = PytestPluginManager()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
193
add_hookspecs
ref
function
pm.add_hookspecs(holder)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
194
HookRecorder
ref
function
rec = HookRecorder(pm)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
195
pytest_xyz
ref
function
pm.hook.pytest_xyz(arg=123)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
196
popcall
ref
function
call = rec.popcall("pytest_xyz")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
199
raises
ref
function
pytest.raises(pytest.fail.Exception, rec.popcall, "abc")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
200
pytest_xyz_noarg
ref
function
pm.hook.pytest_xyz_noarg()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
201
popcall
ref
function
call = rec.popcall("pytest_xyz_noarg")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
205
test_makepyfile_unicode
def
function
def test_makepyfile_unicode(pytester: Pytester) -> None: pytester.makepyfile(chr(0xFFFD))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
206
makepyfile
ref
function
pytester.makepyfile(chr(0xFFFD))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
209
test_makepyfile_utf8
def
function
def test_makepyfile_utf8(pytester: Pytester) -> None: """Ensure makepyfile accepts utf-8 bytes as input (#2738)""" utf8_contents = """ def setup_function(function): mixed_encoding = 'São Paulo' """.encode() p = pytester.makepyfile(utf8_contents) assert "mixed_encoding = 'São Paul...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
215
makepyfile
ref
function
p = pytester.makepyfile(utf8_contents)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
219
TestInlineRunModulesCleanup
def
class
test_inline_run_test_module_not_cleaned_up spy_factory test_inline_run_taking_and_restoring_a_sys_modules_snapshot test_inline_run_sys_modules_snapshot_restore_preserving_modules test_external_test_module_imports_not_cleaned_up
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
220
test_inline_run_test_module_not_cleaned_up
def
function
def test_inline_run_test_module_not_cleaned_up(self, pytester: Pytester) -> None: test_mod = pytester.makepyfile("def test_foo(): assert _True") result = pytester.inline_run(str(test_mod)) assert result.ret == ExitCode.OK # rewrite module, now test should fail if module was re-import...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
221
makepyfile
ref
function
test_mod = pytester.makepyfile("def test_foo(): assert True")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
222
inline_run
ref
function
result = pytester.inline_run(str(test_mod))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
226
inline_run
ref
function
result2 = pytester.inline_run(str(test_mod))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
229
spy_factory
def
function
def spy_factory(self): class SysModulesSnapshotSpy: instances: List["SysModulesSnapshotSpy"] = [] # noqa: F821 def __init__(self, preserve=None) -> None: SysModulesSnapshotSpy.instances.append(self) self._spy_restore_count = 0 self._s...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
230
SysModulesSnapshotSpy
def
class
__init__ restore
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
237
SysModulesSnapshot
ref
function
self.__snapshot = SysModulesSnapshot(preserve=preserve)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
239
restore
def
function
def restore(self): self._spy_restore_count += 1 return self.__snapshot.restore() return SysModulesSnapshotSpy def test_inline_run_taking_and_restoring_a_sys_modules_snapshot( self, pytester: Pytester, monkeypatch: MonkeyPatch ) -> None: spy_f...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
241
restore
ref
function
return self.__snapshot.restore()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
245
test_inline_run_taking_and_restoring_a_sys_modules_snapshot
def
function
def test_inline_run_taking_and_restoring_a_sys_modules_snapshot( self, pytester: Pytester, monkeypatch: MonkeyPatch ) -> None: spy_factory = self.spy_factory() monkeypatch.setattr(pytester_mod, "SysModulesSnapshot", spy_factory) pytester.syspathinsert() original = dict(sy...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
248
spy_factory
ref
function
spy_factory = self.spy_factory()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
250
syspathinsert
ref
function
pytester.syspathinsert()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
252
makepyfile
ref
function
pytester.makepyfile(import1="# you son of a silly person")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
253
makepyfile
ref
function
pytester.makepyfile(import2="# my hovercraft is full of eels")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
254
makepyfile
ref
function
test_mod = pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
259
inline_run
ref
function
pytester.inline_run(str(test_mod))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
266
test_inline_run_sys_modules_snapshot_restore_preserving_modules
def
function
def test_inline_run_sys_modules_snapshot_restore_preserving_modules( self, pytester: Pytester, monkeypatch: MonkeyPatch ) -> None: spy_factory = self.spy_factory() monkeypatch.setattr(pytester_mod, "SysModulesSnapshot", spy_factory) test_mod = pytester.makepyfile("def test_foo():...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
269
spy_factory
ref
function
spy_factory = self.spy_factory()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
271
makepyfile
ref
function
test_mod = pytester.makepyfile("def test_foo(): pass")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
272
inline_run
ref
function
pytester.inline_run(str(test_mod))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
274
_spy_preserve
ref
function
assert not spy._spy_preserve("black_knight")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
275
_spy_preserve
ref
function
assert spy._spy_preserve("zope")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
276
_spy_preserve
ref
function
assert spy._spy_preserve("zope.interface")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
277
_spy_preserve
ref
function
assert spy._spy_preserve("zopelicious")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
279
test_external_test_module_imports_not_cleaned_up
def
function
def test_external_test_module_imports_not_cleaned_up( self, pytester: Pytester ) -> None: pytester.syspathinsert() pytester.makepyfile(imported="data = 'you son of a silly person'") import imported test_mod = pytester.makepyfile( """ def test_foo(...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
282
syspathinsert
ref
function
pytester.syspathinsert()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
283
makepyfile
ref
function
pytester.makepyfile(imported="data = 'you son of a silly person'")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
286
makepyfile
ref
function
test_mod = pytester.makepyfile(
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
292
inline_run
ref
function
pytester.inline_run(str(test_mod))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
296
test_assert_outcomes_after_pytest_error
def
function
def test_assert_outcomes_after_pytest_error(pytester: Pytester) -> None: pytester.makepyfile("def test_foo(): assert _True") result = pytester.runpytest("--unexpected-argument") with pytest.raises(ValueError, match="Pytest terminal summary report not found"): result.assert_outcomes(passed=0)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
297
makepyfile
ref
function
pytester.makepyfile("def test_foo(): assert True")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
299
runpytest
ref
function
result = pytester.runpytest("--unexpected-argument")
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
300
raises
ref
function
with pytest.raises(ValueError, match="Pytest terminal summary report not found"):
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
301
assert_outcomes
ref
function
result.assert_outcomes(passed=0)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
304
test_cwd_snapshot
def
function
def test_cwd_snapshot(pytester: Pytester) -> None: foo = pytester.mkdir("foo") bar = pytester.mkdir("bar") os.chdir(foo) snapshot = CwdSnapshot() os.chdir(bar) assert Path().absolute() == bar snapshot.restore() assert Path().absolute() == foo
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
308
CwdSnapshot
ref
function
snapshot = CwdSnapshot()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
311
restore
ref
function
snapshot.restore()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
315
TestSysModulesSnapshot
def
class
test_remove_added test_add_removed test_restore_reloaded test_preserve_modules test_preserve_container
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
318
test_remove_added
def
function
def test_remove_added(self) -> None: original = dict(sys.modules) assert self.key not in sys.modules snapshot = SysModulesSnapshot() sys.modules[self.key] = ModuleType("something") assert self.key in sys.modules snapshot.restore() assert sys.modules == origina...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
321
SysModulesSnapshot
ref
function
snapshot = SysModulesSnapshot()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
324
restore
ref
function
snapshot.restore()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
327
test_add_removed
def
function
def test_add_removed(self, monkeypatch: MonkeyPatch) -> None: assert self.key not in sys.modules monkeypatch.setitem(sys.modules, self.key, ModuleType("something")) assert self.key in sys.modules original = dict(sys.modules) snapshot = SysModulesSnapshot() del sys.mod...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
329
setitem
ref
function
monkeypatch.setitem(sys.modules, self.key, ModuleType("something"))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
332
SysModulesSnapshot
ref
function
snapshot = SysModulesSnapshot()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
335
restore
ref
function
snapshot.restore()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
338
test_restore_reloaded
def
function
def test_restore_reloaded(self, monkeypatch: MonkeyPatch) -> None: assert self.key not in sys.modules monkeypatch.setitem(sys.modules, self.key, ModuleType("something")) assert self.key in sys.modules original = dict(sys.modules) snapshot = SysModulesSnapshot() sys.mo...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
340
setitem
ref
function
monkeypatch.setitem(sys.modules, self.key, ModuleType("something"))
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
343
SysModulesSnapshot
ref
function
snapshot = SysModulesSnapshot()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
345
restore
ref
function
snapshot.restore()
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
348
test_preserve_modules
def
function
def test_preserve_modules(self, monkeypatch: MonkeyPatch) -> None: key = [self.key + str(i) for i in range(3)] assert not any(k in sys.modules for k in key) for i, k in enumerate(key): mod = ModuleType("something" + str(i)) monkeypatch.setitem(sys.modules, k, mod) ...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
353
setitem
ref
function
monkeypatch.setitem(sys.modules, k, mod)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
356
preserve
def
function
def preserve(name): return name in (key[0], key[1], "some-other-key") snapshot = SysModulesSnapshot(preserve=preserve) sys.modules[key[0]] = original[key[0]] = ModuleType("something else0") sys.modules[key[1]] = original[key[1]] = ModuleType("something else1") sys.mo...
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
359
SysModulesSnapshot
ref
function
snapshot = SysModulesSnapshot(preserve=preserve)
playground/385a4687-3c82-4369-b8de-c1d8c2e759f9/pytest/testing/test_pytester.py
testing/test_pytester.py
363
restore
ref
function
snapshot.restore()