File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -763,3 +763,21 @@ def test_setup_function(self, testdir):
763
763
* call *test_1*
764
764
""" )
765
765
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 ()
You can’t perform that action at this time.
0 commit comments