@@ -268,7 +268,7 @@ def test_checksums(self):
268268
269269 # checksum of length 32 is assumed to be MD5, length 64 to be SHA256, other lengths not allowed
270270 # checksum of length other than 32/64 yields an error
271- error_pattern = "Length of checksum '.*' \(\d+\) does not match with either MD5 \(32\) or SHA256 \(64\)"
271+ error_pattern = r "Length of checksum '.*' \(\d+\) does not match with either MD5 \(32\) or SHA256 \(64\)"
272272 for checksum in ['tooshort' , 'inbetween32and64charactersisnotgoodeither' , known_checksums ['sha256' ] + 'foo' ]:
273273 self .assertErrorRegex (EasyBuildError , error_pattern , ft .verify_checksum , fp , checksum )
274274
@@ -584,7 +584,7 @@ def test_read_write_file(self):
584584
585585 txt2 = '\n ' .join (['test' , '123' ])
586586 ft .write_file (fp , txt2 , append = True )
587- self .assertEqual (ft .read_file (fp ), txt + txt2 )
587+ self .assertEqual (ft .read_file (fp ), txt + txt2 )
588588
589589 # test backing up of existing file
590590 ft .write_file (fp , 'foo' , backup = True )
@@ -1812,7 +1812,7 @@ def test_move_file(self):
18121812 self .mock_stderr (False )
18131813
18141814 # informative message printed, but file was not actually moved
1815- regex = re .compile ("^moved file .*/test\.txt to .*/new_test\.txt$" )
1815+ regex = re .compile (r "^moved file .*/test\.txt to .*/new_test\.txt$" )
18161816 self .assertTrue (regex .search (stdout ), "Pattern '%s' found in: %s" % (regex .pattern , stdout ))
18171817 self .assertEqual (stderr , '' )
18181818
@@ -1875,7 +1875,7 @@ def test_diff_files(self):
18751875 ])
18761876 res = ft .diff_files (foo , bar )
18771877 self .assertTrue (res .endswith (expected ), "%s ends with %s" % (res , expected ))
1878- regex = re .compile ('^--- .*/foo\s*\n \+\+\+ .*/bar\s*$' , re .M )
1878+ regex = re .compile (r '^--- .*/foo\s*\n\+\+\+ .*/bar\s*$' , re .M )
18791879 self .assertTrue (regex .search (res ), "Pattern '%s' found in: %s" % (regex .pattern , res ))
18801880
18811881 def test_get_source_tarball_from_git (self ):
@@ -1966,42 +1966,52 @@ def run_check():
19661966 'tag' : 'master' ,
19671967 }
19681968 expected = '\n ' .join ([
1969- ' running command "git clone --branch master [email protected] :hpcugent/testrepository.git"' ,
1970- " \(in .*/tmp.*\)" ,
1971- ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
1972- " \(in .*/tmp.*\)" ,
1969+ r ' running command "git clone --branch master [email protected] :hpcugent/testrepository.git"',
1970+ r " \(in .*/tmp.*\)" ,
1971+ r ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
1972+ r " \(in .*/tmp.*\)" ,
19731973 ])
19741974 run_check ()
19751975
19761976 git_config ['recursive' ] = True
19771977 expected = '\n ' .join ([
1978- ' running command "git clone --branch master --recursive [email protected] :hpcugent/testrepository.git"' ,
1979- " \(in .*/tmp.*\)" ,
1980- ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
1981- " \(in .*/tmp.*\)" ,
1978+ r ' running command "git clone --branch master --recursive [email protected] :hpcugent/testrepository.git"',
1979+ r " \(in .*/tmp.*\)" ,
1980+ r ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
1981+ r " \(in .*/tmp.*\)" ,
19821982 ])
19831983 run_check ()
19841984
1985+ git_config ['keep_git_dir' ] = True
1986+ expected = '\n ' .join ([
1987+ r' running command "git clone --branch master --recursive [email protected] :hpcugent/testrepository.git"' ,
1988+ r" \(in .*/tmp.*\)" ,
1989+ r' running command "tar cfvz .*/target/test.tar.gz testrepository"' ,
1990+ r" \(in .*/tmp.*\)" ,
1991+ ])
1992+ run_check ()
1993+ del git_config ['keep_git_dir' ]
1994+
19851995 del git_config ['tag' ]
19861996 git_config ['commit' ] = '8456f86'
19871997 expected = '\n ' .join ([
1988- ' running command "git clone --recursive [email protected] :hpcugent/testrepository.git"' ,
1989- " \(in .*/tmp.*\)" ,
1990- ' running command "git checkout 8456f86 && git submodule update"' ,
1991- " \(in testrepository\)" ,
1992- ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
1993- " \(in .*/tmp.*\)" ,
1998+ r ' running command "git clone --recursive [email protected] :hpcugent/testrepository.git"',
1999+ r " \(in .*/tmp.*\)" ,
2000+ r ' running command "git checkout 8456f86 && git submodule update"' ,
2001+ r " \(in testrepository\)" ,
2002+ r ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
2003+ r " \(in .*/tmp.*\)" ,
19942004 ])
19952005 run_check ()
19962006
19972007 del git_config ['recursive' ]
19982008 expected = '\n ' .join ([
1999- ' running command "git clone [email protected] :hpcugent/testrepository.git"' ,
2000- " \(in .*/tmp.*\)" ,
2001- ' running command "git checkout 8456f86"' ,
2002- " \(in testrepository\)" ,
2003- ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
2004- " \(in .*/tmp.*\)" ,
2009+ r ' running command "git clone [email protected] :hpcugent/testrepository.git"',
2010+ r " \(in .*/tmp.*\)" ,
2011+ r ' running command "git checkout 8456f86"' ,
2012+ r " \(in testrepository\)" ,
2013+ r ' running command "tar cfvz .*/target/test.tar.gz --exclude .git testrepository"' ,
2014+ r " \(in .*/tmp.*\)" ,
20052015 ])
20062016 run_check ()
20072017
@@ -2016,7 +2026,7 @@ def test_is_sha256_checksum(self):
20162026 True ,
20172027 12345 ,
20182028 '' ,
2019- (a_sha256_checksum , ),
2029+ (a_sha256_checksum ,),
20202030 [],
20212031 ]:
20222032 self .assertFalse (ft .is_sha256_checksum (not_a_sha256_checksum ))
@@ -2078,7 +2088,6 @@ def test_fake_vsc(self):
20782088 self .assertTrue (pkgutil .__file__ .endswith ('/test_fake_vsc/pkgutil.py' ))
20792089
20802090
2081-
20822091def suite ():
20832092 """ returns all the testcases in this module """
20842093 return TestLoaderFiltered ().loadTestsFromTestCase (FileToolsTest , sys .argv [1 :])
0 commit comments