MCPcopy
hub / github.com/pytest-dev/pytest / test_zipfile

Method test_zipfile

testing/test_assertrewrite.py:1020–1036  ·  view source on GitHub ↗
(self, pytester: Pytester)

Source from the content-addressed store, hash-verified

1018 cache.chmod(old_mode)
1019
1020 def test_zipfile(self, pytester: Pytester) -> None:
1021 z = pytester.path.joinpath("myzip.zip")
1022 z_fn = str(z)
1023 f = zipfile.ZipFile(z_fn, "w")
1024 try:
1025 f.writestr("test_gum/__init__.py", "")
1026 f.writestr("test_gum/test_lizard.py", "")
1027 finally:
1028 f.close()
1029 z.chmod(256)
1030 pytester.makepyfile(
1031 f"""
1032 import sys
1033 sys.path.append({z_fn!r})
1034 import test_gum.test_lizard"""
1035 )
1036 assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
1037
1038 def test_load_resource_via_files_with_rewrite(self, pytester: Pytester) -> None:
1039 example = pytester.path.joinpath("demo") / "example"

Callers

nothing calls this directly

Calls 4

chmodMethod · 0.80
closeMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected