@@ -845,9 +845,23 @@ def test_decompress_infile_outfile(self):
845
845
846
846
self .assertTrue (os .path .exists (igzipname ))
847
847
848
+ # The following tests use assert_python_failure or assert_python_ok.
849
+ #
850
+ # If the env_vars argument to assert_python_failure or assert_python_ok
851
+ # is empty the test will run in isolated mode (-I) which means that the
852
+ # PYTHONPATH environment variable will be ignored and the test fails
853
+ # because the isal module can not be found, or the test is run usung the
854
+ # system installed version of the module instead of the newly built
855
+ # module that should be tested.
856
+ #
857
+ # By adding a dummy entry to the env_vars argument the isolated mode is
858
+ # not used and the PYTHONPATH environment variable is not ignored and
859
+ # the test works as expected.
860
+
848
861
def test_decompress_infile_outfile_error (self ):
849
862
rc , out , err = assert_python_failure ('-m' , 'isal.igzip' , '-d' ,
850
- 'thisisatest.out' )
863
+ 'thisisatest.out' ,
864
+ ** {'_dummy' : '1' })
851
865
self .assertEqual (b"filename doesn't end in .gz: 'thisisatest.out'. "
852
866
b"Cannot determine output filename." ,
853
867
err .strip ())
@@ -872,7 +886,8 @@ def test_compress_infile_outfile_default(self):
872
886
with open (local_testigzip , 'wb' ) as fp :
873
887
fp .write (self .data )
874
888
875
- rc , out , err = assert_python_ok ('-m' , 'isal.igzip' , local_testigzip )
889
+ rc , out , err = assert_python_ok ('-m' , 'isal.igzip' , local_testigzip ,
890
+ ** {'_dummy' : '1' })
876
891
877
892
self .assertTrue (os .path .exists (igzipname ))
878
893
self .assertEqual (out , b'' )
@@ -891,7 +906,8 @@ def test_compress_infile_outfile(self):
891
906
892
907
rc , out , err = assert_python_ok ('-m' , 'isal.igzip' ,
893
908
compress_level ,
894
- local_testigzip )
909
+ local_testigzip ,
910
+ ** {'_dummy' : '1' })
895
911
896
912
self .assertTrue (os .path .exists (igzipname ))
897
913
self .assertEqual (out , b'' )
@@ -901,15 +917,15 @@ def test_compress_infile_outfile(self):
901
917
902
918
def test_compress_fast_best_are_exclusive (self ):
903
919
rc , out , err = assert_python_failure ('-m' , 'isal.igzip' , '--fast' ,
904
- '--best' )
920
+ '--best' , ** { '_dummy' : '1' } )
905
921
self .assertIn (
906
922
b"error: argument -3/--best: not allowed with argument -0/--fast" ,
907
923
err )
908
924
self .assertEqual (out , b'' )
909
925
910
926
def test_decompress_cannot_have_flags_compression (self ):
911
927
rc , out , err = assert_python_failure ('-m' , 'isal.igzip' , '--fast' ,
912
- '-d' )
928
+ '-d' , ** { '_dummy' : '1' } )
913
929
self .assertIn (
914
930
b'error: argument -d/--decompress: not allowed with argument '
915
931
b'-0/--fast' ,
0 commit comments