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

Method test_zipfile

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

Source from the content-addressed store, hash-verified

777 cache.chmod(old_mode)
778
779 def test_zipfile(self, pytester: Pytester) -> None:
780 z = pytester.path.joinpath("myzip.zip")
781 z_fn = str(z)
782 f = zipfile.ZipFile(z_fn, "w")
783 try:
784 f.writestr("test_gum/__init__.py", "")
785 f.writestr("test_gum/test_lizard.py", "")
786 finally:
787 f.close()
788 z.chmod(256)
789 pytester.makepyfile(
790 """
791 import sys
792 sys.path.append(%r)
793 import test_gum.test_lizard"""
794 % (z_fn,)
795 )
796 assert pytester.runpytest().ret == ExitCode.NO_TESTS_COLLECTED
797
798 @pytest.mark.skipif(
799 sys.version_info < (3, 9),

Callers

nothing calls this directly

Calls 3

closeMethod · 0.45
makepyfileMethod · 0.45
runpytestMethod · 0.45

Tested by

no test coverage detected