Skip to content

Commit

Permalink
Add acceptance test for module loader
Browse files Browse the repository at this point in the history
Related to #1837
  • Loading branch information
nicoddemus committed Aug 22, 2016
1 parent 678750c commit 6a8160b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions testing/acceptance_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,3 +763,21 @@ def test_setup_function(self, testdir):
* call *test_1*
""")


def test_zipimport_hook(testdir, tmpdir):
"""Test package loader is being used correctly (see #1837)."""
zipapp = pytest.importorskip('zipapp')
testdir.tmpdir.join('app').ensure(dir=1)
testdir.makepyfile(**{
'app/foo.py': """
import pytest
def main():
pytest.main(['--pyarg', 'foo'])
""",
})
target = tmpdir.join('foo.zip')
zipapp.create_archive(str(testdir.tmpdir.join('app')), str(target), main='foo:main')
result = testdir.runpython(target)
assert result.ret == 0
result.stderr.fnmatch_lines(['*not found*foo*'])
assert 'INTERNALERROR>' not in result.stdout.str()

0 comments on commit 6a8160b

Please sign in to comment.