MCPcopy Create free account
hub / github.com/pytest-dev/pytest / importasmod

Method importasmod

testing/code/test_excinfo.py:439–448  ·  view source on GitHub ↗
(self, tmp_path: Path, _sys_snapshot)

Source from the content-addressed store, hash-verified

437class TestFormattedExcinfo:
438 @pytest.fixture
439 def importasmod(self, tmp_path: Path, _sys_snapshot):
440 def importasmod(source):
441 source = textwrap.dedent(source)
442 modpath = tmp_path.joinpath("mod.py")
443 tmp_path.joinpath("__init__.py").touch()
444 modpath.write_text(source)
445 importlib.invalidate_caches()
446 return import_path(modpath, root=tmp_path)
447
448 return importasmod
449
450 def test_repr_source(self):
451 pr = FormattedExcinfo()

Callers

nothing calls this directly

Calls 1

import_pathFunction · 0.90

Tested by

no test coverage detected