@@ -97,6 +97,10 @@ def test_extract_cmd(self):
9797 ('test.iso' , "7z x test.iso" ),
9898 ('test.tar.Z' , "tar xzf test.tar.Z" ),
9999 ('test.foo.bar.sh' , "cp -a test.foo.bar.sh ." ),
100+ # check whether extension is stripped correct to determine name of target file
101+ # cfr. https://github.com/easybuilders/easybuild-framework/pull/3705
102+ ('testbz2.bz2' , "bunzip2 -c testbz2.bz2 > testbz2" ),
103+ ('testgz.gz' , "gunzip -c testgz.gz > testgz" ),
100104 ]
101105 for (fn , expected_cmd ) in tests :
102106 cmd = ft .extract_cmd (fn )
@@ -926,14 +930,18 @@ def test_back_up_file(self):
926930 self .assertEqual (ft .read_file (fp ), new_txt )
927931
928932 # check whether strip_fn works as expected
929- fp2 = fp + '.lua'
933+ fp2 = fp + 'a .lua'
930934 ft .copy_file (fp , fp2 )
931935 res = ft .back_up_file (fp2 )
932936 self .assertTrue (fp2 .endswith ('.lua' ))
933937 self .assertTrue ('.lua' in os .path .basename (res ))
934938
935939 res = ft .back_up_file (fp2 , strip_fn = '.lua' )
936940 self .assertFalse ('.lua' in os .path .basename (res ))
941+ # strip_fn should not remove the first a in 'a.lua'
942+ expected = os .path .basename (fp ) + 'a.bak_'
943+ res_fn = os .path .basename (res )
944+ self .assertTrue (res_fn .startswith (expected ), "'%s' should start with with '%s'" % (res_fn , expected ))
937945
938946 def test_move_logs (self ):
939947 """Test move_logs function."""
0 commit comments