Skip to content

Commit 6a8160b

Browse files
committed
Add acceptance test for module loader
Related to #1837
1 parent 678750c commit 6a8160b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

testing/acceptance_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -763,3 +763,21 @@ def test_setup_function(self, testdir):
763763
* call *test_1*
764764
""")
765765

766+
767+
def test_zipimport_hook(testdir, tmpdir):
768+
"""Test package loader is being used correctly (see #1837)."""
769+
zipapp = pytest.importorskip('zipapp')
770+
testdir.tmpdir.join('app').ensure(dir=1)
771+
testdir.makepyfile(**{
772+
'app/foo.py': """
773+
import pytest
774+
def main():
775+
pytest.main(['--pyarg', 'foo'])
776+
""",
777+
})
778+
target = tmpdir.join('foo.zip')
779+
zipapp.create_archive(str(testdir.tmpdir.join('app')), str(target), main='foo:main')
780+
result = testdir.runpython(target)
781+
assert result.ret == 0
782+
result.stderr.fnmatch_lines(['*not found*foo*'])
783+
assert 'INTERNALERROR>' not in result.stdout.str()

0 commit comments

Comments
 (0)