@@ -804,6 +804,19 @@ def test_decompress_stdin_stdout(self):
804804 self .assertEqual (err , b'' )
805805 self .assertEqual (out , self .data )
806806
807+ # The following tests use assert_python_failure or assert_python_ok.
808+ #
809+ # If the env_vars argument to assert_python_failure or assert_python_ok
810+ # is empty the test will run in isolated mode (-I) which means that the
811+ # PYTHONPATH environment variable will be ignored and the test fails
812+ # because the isal module can not be found, or the test is run usung the
813+ # system installed version of the module instead of the newly built
814+ # module that should be tested.
815+ #
816+ # By adding a dummy entry to the env_vars argument the isolated mode is
817+ # not used and the PYTHONPATH environment variable is not ignored and
818+ # the test works as expected.
819+
807820 @create_and_remove_directory (TEMPDIR )
808821 def test_decompress_infile_outfile (self ):
809822 gzipname = os .path .join (TEMPDIR , 'testgzip.gz' )
@@ -812,7 +825,7 @@ def test_decompress_infile_outfile(self):
812825 with gzip .open (gzipname , mode = 'wb' ) as fp :
813826 fp .write (self .data )
814827 rc , out , err = assert_python_ok ('-m' , 'zlib_ng.gzip_ng' , '-d' ,
815- gzipname )
828+ gzipname , ** { '_dummy' : '1' } )
816829
817830 with open (os .path .join (TEMPDIR , "testgzip" ), "rb" ) as gunziped :
818831 self .assertEqual (gunziped .read (), self .data )
@@ -824,7 +837,7 @@ def test_decompress_infile_outfile(self):
824837
825838 def test_decompress_infile_outfile_error (self ):
826839 rc , out , err = assert_python_failure ('-m' , 'zlib_ng.gzip_ng' , '-d' ,
827- 'thisisatest.out' )
840+ 'thisisatest.out' , ** { '_dummy' : '1' } )
828841 self .assertIn (b"filename doesn't end in .gz: 'thisisatest.out'" ,
829842 err .strip ())
830843 self .assertEqual (rc , 1 )
@@ -849,7 +862,7 @@ def test_compress_infile_outfile_default(self):
849862 fp .write (self .data )
850863
851864 rc , out , err = assert_python_ok ('-m' , 'zlib_ng.gzip_ng' ,
852- local_testgzip )
865+ local_testgzip , ** { '_dummy' : '1' } )
853866
854867 self .assertTrue (os .path .exists (gzipname ))
855868 self .assertEqual (out , b'' )
@@ -867,7 +880,8 @@ def test_compress_infile_outfile(self):
867880 fp .write (self .data )
868881
869882 rc , out , err = assert_python_ok ('-m' , 'zlib_ng.gzip_ng' ,
870- compress_level , local_testgzip )
883+ compress_level , local_testgzip ,
884+ ** {'_dummy' : '1' })
871885
872886 self .assertTrue (os .path .exists (gzipname ))
873887 self .assertEqual (out , b'' )
@@ -877,15 +891,15 @@ def test_compress_infile_outfile(self):
877891
878892 def test_compress_fast_best_are_exclusive (self ):
879893 rc , out , err = assert_python_failure ('-m' , 'zlib_ng.gzip_ng' , '--fast' ,
880- '--best' )
894+ '--best' , ** { '_dummy' : '1' } )
881895 self .assertIn (
882896 b"error: argument -9/--best: not allowed with argument -1/--fast" ,
883897 err )
884898 self .assertEqual (out , b'' )
885899
886900 def test_decompress_cannot_have_flags_compression (self ):
887901 rc , out , err = assert_python_failure ('-m' , 'zlib_ng.gzip_ng' , '--fast' ,
888- '-d' )
902+ '-d' , ** { '_dummy' : '1' } )
889903 self .assertIn (
890904 b'error: argument -d/--decompress: not allowed with argument -1/--fast' ,
891905 err )
0 commit comments