@@ -85,12 +85,12 @@ def check_extra_options_format(extra_options):
8585 """Make sure extra_options value is of correct format."""
8686 # EasyBuild v2.0: dict with <string> keys and <list> values
8787 # (breaks backward compatibility compared to v1.x)
88- self .assertTrue ( isinstance ( extra_options , dict ) ) # conversion to a dict works
88+ self .assertIsInstance ( extra_options , dict ) # conversion to a dict works
8989 extra_options .items ()
9090 extra_options .keys ()
9191 extra_options .values ()
9292 for key in extra_options .keys ():
93- self .assertTrue ( isinstance ( extra_options [key ], list ) )
93+ self .assertIsInstance ( extra_options [key ], list )
9494 self .assertEqual (len (extra_options [key ]), 3 )
9595
9696 name = "pi"
@@ -201,7 +201,7 @@ def test_load_module(self):
201201
202202 # we expect $TMPDIR to be tweaked by the prepare step (OpenMPI 2.x doesn't like long $TMPDIR values)
203203 tweaked_tmpdir = os .environ .get ('TMPDIR' )
204- self .assertTrue (tweaked_tmpdir != orig_tmpdir )
204+ self .assertNotEqual (tweaked_tmpdir , orig_tmpdir )
205205
206206 eb .make_module_step ()
207207 eb .load_module ()
@@ -233,7 +233,7 @@ def test_fake_module_load(self):
233233 if get_module_syntax () == 'Lua' :
234234 pi_modfile += '.lua'
235235
236- self .assertTrue ( os . path . exists ( pi_modfile ) )
236+ self .assertExists ( pi_modfile )
237237
238238 # check whether temporary module file is marked as default
239239 if get_module_syntax () == 'Lua' :
@@ -667,7 +667,7 @@ def test_make_module_extra(self):
667667 if get_module_syntax () == 'Lua' :
668668 modpath += '.lua'
669669
670- self .assertTrue ( os . path . exists ( modpath ), "%s exists" % modpath )
670+ self .assertExists ( modpath )
671671 txt = read_file (modpath )
672672 patterns = [
673673 r"^prepend[-_]path.*TEST_PATH_VAR.*root.*foo" ,
@@ -1202,7 +1202,7 @@ def test_make_module_step(self):
12021202 modpath = os .path .join (eb .make_module_step (), name , version )
12031203 if get_module_syntax () == 'Lua' :
12041204 modpath += '.lua'
1205- self .assertTrue ( os . path . exists ( modpath ), "%s exists" % modpath )
1205+ self .assertExists ( modpath )
12061206
12071207 # verify contents of module
12081208 txt = read_file (modpath )
@@ -1373,13 +1373,13 @@ def test_make_builddir(self):
13731373 builddir = eb .builddir
13741374 testfile = os .path .join (builddir , 'test123' , 'foobar.txt' )
13751375 write_file (testfile , 'test123' )
1376- self .assertTrue ( os . path . exists ( testfile ) )
1376+ self .assertExists ( testfile )
13771377
13781378 eb .make_builddir ()
13791379 self .assertEqual (builddir , eb .builddir )
13801380 # file is gone because directory was removed and re-created
1381- self .assertFalse ( os . path . exists ( testfile ) )
1382- self .assertFalse (os .path .exists ( os . path . dirname (testfile ) ))
1381+ self .assertNotExists ( testfile )
1382+ self .assertNotExists (os .path .dirname (testfile ))
13831383 self .assertEqual (os .listdir (eb .builddir ), [])
13841384
13851385 # make sure that build directory does *not* get re-created when we're building in installation directory
@@ -1391,7 +1391,7 @@ def test_make_builddir(self):
13911391 builddir = eb .builddir
13921392 testfile = os .path .join (builddir , 'test123' , 'foobar.txt' )
13931393 write_file (testfile , 'test123' )
1394- self .assertTrue ( os . path . exists ( testfile ) )
1394+ self .assertExists ( testfile )
13951395 self .assertEqual (os .listdir (eb .builddir ), ['test123' ])
13961396 self .assertEqual (os .listdir (os .path .join (eb .builddir , 'test123' )), ['foobar.txt' ])
13971397
@@ -1400,7 +1400,7 @@ def test_make_builddir(self):
14001400 eb .make_builddir ()
14011401 eb .make_installdir ()
14021402 self .assertEqual (builddir , eb .builddir )
1403- self .assertTrue ( os . path . exists ( testfile ) )
1403+ self .assertExists ( testfile )
14041404 self .assertEqual (os .listdir (eb .builddir ), ['test123' ])
14051405 self .assertEqual (os .listdir (os .path .join (eb .builddir , 'test123' )), ['foobar.txt' ])
14061406
@@ -1409,8 +1409,8 @@ def test_make_builddir(self):
14091409 eb .make_builddir ()
14101410 eb .make_installdir ()
14111411 self .assertEqual (builddir , eb .builddir )
1412- self .assertFalse ( os . path . exists ( testfile ) )
1413- self .assertFalse (os .path .exists ( os . path . dirname (testfile ) ))
1412+ self .assertNotExists ( testfile )
1413+ self .assertNotExists (os .path .dirname (testfile ))
14141414 self .assertEqual (os .listdir (eb .builddir ), [])
14151415
14161416 def test_get_easyblock_instance (self ):
@@ -1420,7 +1420,7 @@ def test_get_easyblock_instance(self):
14201420
14211421 ec = process_easyconfig (os .path .join (testdir , 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' ))[0 ]
14221422 eb = get_easyblock_instance (ec )
1423- self .assertTrue ( isinstance ( eb , EB_toy ) )
1423+ self .assertIsInstance ( eb , EB_toy )
14241424
14251425 # check whether 'This is easyblock' log message is there
14261426 tup = ('EB_toy' , 'easybuild.easyblocks.toy' , '.*test/framework/sandbox/easybuild/easyblocks/t/toy.pyc*' )
@@ -1482,9 +1482,9 @@ def test_fetch_sources(self):
14821482 self .assertEqual (len (eb .src ), 3 )
14831483 for idx in range (3 ):
14841484 self .assertEqual (eb .src [idx ]['name' ], expected_sources [idx ])
1485- self .assertTrue ( os . path . exists ( eb .src [idx ]['path' ]) )
1485+ self .assertExists ( eb .src [idx ]['path' ])
14861486 source_loc = os .path .join (toy_source_dir , expected_sources [idx ])
1487- self .assertTrue ( os . path . exists ( source_loc ) )
1487+ self .assertExists ( source_loc )
14881488 self .assertTrue (os .path .samefile (eb .src [idx ]['path' ], source_loc ))
14891489 self .assertEqual (eb .src [0 ]['cmd' ], None )
14901490 self .assertEqual (eb .src [1 ]['cmd' ], "gunzip %s" )
@@ -1750,7 +1750,7 @@ def test_obtain_file(self):
17501750
17511751 # toy tarball was indeed re-downloaded to tmpdir
17521752 self .assertEqual (res , os .path .join (tmpdir , 't' , 'toy' , toy_tarball ))
1753- self .assertTrue (os .path .exists ( os . path . join (tmpdir , 't' , 'toy' , toy_tarball ) ))
1753+ self .assertExists (os .path .join (tmpdir , 't' , 'toy' , toy_tarball ))
17541754
17551755 # obtain_file yields error for non-existing files
17561756 fn = 'thisisclearlyanonexistingfile'
@@ -1783,7 +1783,7 @@ def test_obtain_file(self):
17831783 if res is not None :
17841784 loc = os .path .join (tmpdir , 't' , 'toy' , fn )
17851785 self .assertEqual (res , loc )
1786- self .assertTrue ( os . path . exists ( loc ), "%s file is found at %s" % (fn , loc ) )
1786+ self .assertExists ( loc ), "%s file is found at %s" % (fn , loc )
17871787 txt = read_file (loc )
17881788 eb_regex = re .compile ("EasyBuild: building software with ease" )
17891789 self .assertTrue (eb_regex .search (txt ), "Pattern '%s' found in: %s" % (eb_regex .pattern , txt ))
@@ -1833,7 +1833,7 @@ def test_collect_exts_file_info(self):
18331833
18341834 exts_file_info = toy_eb .collect_exts_file_info ()
18351835
1836- self .assertTrue ( isinstance ( exts_file_info , list ) )
1836+ self .assertIsInstance ( exts_file_info , list )
18371837 self .assertEqual (len (exts_file_info ), 4 )
18381838
18391839 self .assertEqual (exts_file_info [0 ], {'name' : 'ls' })
@@ -1858,7 +1858,7 @@ def test_collect_exts_file_info(self):
18581858 # location of files is missing when fetch_files is set to False
18591859 exts_file_info = toy_eb .collect_exts_file_info (fetch_files = False , verify_checksums = False )
18601860
1861- self .assertTrue ( isinstance ( exts_file_info , list ) )
1861+ self .assertIsInstance ( exts_file_info , list )
18621862 self .assertEqual (len (exts_file_info ), 4 )
18631863
18641864 self .assertEqual (exts_file_info [0 ], {'name' : 'ls' })
@@ -1897,7 +1897,7 @@ def test_obtain_file_extension(self):
18971897 ext = ExtensionEasyBlock (toy_eb , test_ext )
18981898 ext_src_path = ext .obtain_file (test_ext_src_fn )
18991899 self .assertEqual (os .path .basename (ext_src_path ), 'toy-0.0.tar.gz' )
1900- self .assertTrue ( os . path . exists ( ext_src_path ) )
1900+ self .assertExists ( ext_src_path )
19011901
19021902 def test_check_readiness (self ):
19031903 """Test check_readiness method."""
@@ -2135,7 +2135,7 @@ def test_guess_start_dir(self):
21352135 ec = process_easyconfig (os .path .join (test_easyconfigs , 't' , 'toy' , 'toy-0.0.eb' ))[0 ]
21362136
21372137 cwd = os .getcwd ()
2138- self .assertTrue ( os . path . exists ( cwd ) )
2138+ self .assertExists ( cwd )
21392139
21402140 def check_start_dir (expected_start_dir ):
21412141 """Check start dir."""
@@ -2170,7 +2170,7 @@ def test_extension_set_start_dir(self):
21702170 ec = process_easyconfig (os .path .join (test_easyconfigs , 't' , 'toy' , 'toy-0.0.eb' ))[0 ]
21712171
21722172 cwd = os .getcwd ()
2173- self .assertTrue ( os . path . exists ( cwd ) )
2173+ self .assertExists ( cwd )
21742174
21752175 def check_ext_start_dir (expected_start_dir ):
21762176 """Check start dir."""
@@ -2608,8 +2608,8 @@ def run_checks():
26082608 def test_this_is_easybuild (self ):
26092609 """Test 'this_is_easybuild' function (and get_git_revision function used by it)."""
26102610 # make sure both return a non-Unicode string
2611- self .assertTrue ( isinstance ( get_git_revision (), str ) )
2612- self .assertTrue ( isinstance ( this_is_easybuild (), str ) )
2611+ self .assertIsInstance ( get_git_revision (), str )
2612+ self .assertIsInstance ( this_is_easybuild (), str )
26132613
26142614 def test_stale_module_caches (self ):
26152615 """Test whether module caches are reset between builds."""
0 commit comments