Test package loader is being used correctly (see #1837).
(pytester: Pytester)
| 960 | |
| 961 | |
| 962 | def test_zipimport_hook(pytester: Pytester) -> None: |
| 963 | """Test package loader is being used correctly (see #1837).""" |
| 964 | zipapp = pytest.importorskip("zipapp") |
| 965 | pytester.path.joinpath("app").mkdir() |
| 966 | pytester.makepyfile( |
| 967 | **{ |
| 968 | "app/foo.py": """ |
| 969 | import pytest |
| 970 | def main(): |
| 971 | pytest.main(['--pyargs', 'foo']) |
| 972 | """ |
| 973 | } |
| 974 | ) |
| 975 | target = pytester.path.joinpath("foo.zip") |
| 976 | zipapp.create_archive( |
| 977 | str(pytester.path.joinpath("app")), str(target), main="foo:main" |
| 978 | ) |
| 979 | result = pytester.runpython(target) |
| 980 | assert result.ret == 0 |
| 981 | result.stderr.fnmatch_lines(["*not found*foo*"]) |
| 982 | result.stdout.no_fnmatch_line("*INTERNALERROR>*") |
| 983 | |
| 984 | |
| 985 | def test_import_plugin_unicode_name(pytester: Pytester) -> None: |
nothing calls this directly
no test coverage detected