Skip to content

Commit

Permalink
conditionally include setup.py in list of test files in test_copy_fra…
Browse files Browse the repository at this point in the history
…mework_files, since it may not be there...
  • Loading branch information
boegel committed Apr 7, 2020
1 parent bd91e0a commit aab059c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/framework/filetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2204,8 +2204,21 @@ def test_copy_framework_files(self):
os.path.join('easybuild', 'tools', 'filetools.py'),
os.path.join('test', 'framework', 'modules.py'),
os.path.join('test', 'framework', 'sandbox', 'sources', 'toy', 'toy-0.0.tar.gz'),
os.path.join('setup.py'),
]
expected_entries = ['easybuild', 'test']
# test/framework/modules.py is not new
expected_new = [True, False, True]

# we include setup.py conditionally because it may not be there,
# for example when running the tests on an actual easybuild-framework instalation,
# as opposed to when running from a repository checkout...
# setup.py is an important test case, since it has no parent directory
# (it's straight in the easybuild-framework directory)
setup_py = 'setup.py'
if os.path.exists(os.path.join(topdir, setup_py)):
test_files.append(os.path.join(setup_py))
expected_entries.append(setup_py)
expected_new.append(True)

# files being copied are expected to be in a directory named 'easybuild-framework',
# so we need to make sure that's the case here as well (may not be in workspace dir on Travis from example)
Expand All @@ -2217,7 +2230,7 @@ def test_copy_framework_files(self):

res = ft.copy_framework_files(test_paths, target_dir)

self.assertEqual(sorted(os.listdir(target_dir)), ['easybuild', 'setup.py', 'test'])
self.assertEqual(sorted(os.listdir(target_dir)), sorted(expected_entries))

self.assertEqual(sorted(res.keys()), ['new', 'paths_in_repo'])

Expand All @@ -2230,7 +2243,7 @@ def test_copy_framework_files(self):

self.assertTrue(os.path.samefile(copied_path, res['paths_in_repo'][idx]))

self.assertEqual(res['new'], [True, False, True, True]) # test/framework/moduels.py is not new
self.assertEqual(res['new'], expected_new)


def suite():
Expand Down

0 comments on commit aab059c

Please sign in to comment.