@@ -1684,7 +1684,11 @@ def test_obtain_file(self):
16841684 mkdir (tmpdir_subdir , parents = True )
16851685 del os .environ ['EASYBUILD_SOURCEPATH' ] # defined by setUp
16861686
1687- ec = process_easyconfig (os .path .join (testdir , 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' ))[0 ]
1687+ toy_ec = os .path .join (testdir , 'easyconfigs' , 'test_ecs' , 't' , 'toy' , 'toy-0.0.eb' )
1688+ test_ec = os .path .join (tmpdir , 'ecs' , 'test.eb' )
1689+ copy_file (toy_ec , test_ec )
1690+
1691+ ec = process_easyconfig (test_ec )[0 ]
16881692 eb = EasyBlock (ec ['ec' ])
16891693
16901694 # 'downloading' a file to (first) sourcepath works
@@ -1697,6 +1701,15 @@ def test_obtain_file(self):
16971701 res = eb .obtain_file (toy_tarball , urls = ['file://%s' % tmpdir_subdir ], alt_location = 'alt_toy' )
16981702 self .assertEqual (res , os .path .join (tmpdir , 'a' , 'alt_toy' , toy_tarball ))
16991703
1704+ # make sure that directory in which easyconfig file is located is *ignored* when alt_location is used
1705+ dummy_toy_tar_gz = os .path .join (os .path .dirname (test_ec ), 'toy-0.0.tar.gz' )
1706+ write_file (dummy_toy_tar_gz , '' )
1707+ res = eb .obtain_file (toy_tarball , urls = ['file://%s' % tmpdir_subdir ])
1708+ self .assertEqual (res , dummy_toy_tar_gz )
1709+ res = eb .obtain_file (toy_tarball , urls = ['file://%s' % tmpdir_subdir ], alt_location = 'alt_toy' )
1710+ self .assertEqual (res , os .path .join (tmpdir , 'a' , 'alt_toy' , toy_tarball ))
1711+ remove_file (dummy_toy_tar_gz )
1712+
17001713 # finding a file in sourcepath works
17011714 init_config (args = ["--sourcepath=%s:/no/such/dir:%s" % (sandbox_sources , tmpdir )])
17021715 res = eb .obtain_file (toy_tarball )
0 commit comments