Repository navigation
[6/6] Use constants for commonly used test easyconfig folders, files and content - #5251
Conversation
|
@Flamefire needs rebase after merge of #5255 |
6bb5e6a to
397961c
Compare
64a4141 to
107e815
Compare
|
@Flamefire conflict to solve |
107e815 to
bf3122b
Compare
|
Done, CI passed again :) |
3cf82b7 to
bda983a
Compare
| args = ['--search', 'nosuchsoftware-1.2.3.4.5'] | ||
| self.assertRaisesRegex(SystemExit, 'MISSING_EASYCONFIG|4', self.eb_main, args, | ||
| self.assertRaisesRegex(SystemExit, 'MISSING_EASYCONFIG|4', self.eb_main, | ||
| args + ['--search', 'nosuchsoftware-1.2.3.4.5'], |
There was a problem hiding this comment.
Strictly speaking --robot=... should not be part of args here so this one should probably be reverted
There was a problem hiding this comment.
I would say this is a bug: every other subtest uses arg + [extra]
Turns out none of them required it: The setup-step sets robot-paths, so I removed args completely
| test_ecs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') | ||
| test_ecs = TEST_ECS_DIR | ||
| gzip_ec = os.path.join(test_ecs, 'g', 'gzip', 'gzip-1.5-foss-2018a.eb') |
There was a problem hiding this comment.
Why not go all the way here?
There was a problem hiding this comment.
I missed those, not sure why.
| test_ecs_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') | ||
| test_ecs_path = TEST_ECS_DIR | ||
| ecstmpdir = tempfile.mkdtemp(prefix='easybuild-easyconfigs-pkg-install-path') | ||
| mkdir(os.path.join(ecstmpdir, 'easybuild'), parents=True) | ||
| copy_dir(test_ecs_path, os.path.join(ecstmpdir, 'easybuild', 'easyconfigs')) |
There was a problem hiding this comment.
And why not all the way here too (and the rest of the test_ecs_path instances below)
| test_dir = TEST_DIR | ||
| ec_file = os.path.join(TEST_ECS_DIR, 'f', 'foss', 'foss-2018a.eb') | ||
| os.environ['MODULEPATH'] = str(TEST_MODULES_DIR) | ||
| args = [ | ||
| ec_file, | ||
| '--robot=%s' % os.path.join(test_dir, 'easyconfigs'), |
There was a problem hiding this comment.
Why not all the way with test_dir?
There was a problem hiding this comment.
Same here test_ecs_path -> TEST_ECS_DIR
| @@ -5292,7 +5213,7 @@ def test_show_config(self): | |||
| r"ignoreconfigfiles\s* \(E\) = %s" % ', '.join(os.environ['EASYBUILD_IGNORECONFIGFILES'].split(',')), | |||
| r"installpath\s* \(E\) = " + os.path.join(self.test_prefix, 'tmp.*'), | |||
| r"repositorypath\s* \(D\) = " + os.path.join(default_prefix, 'ebfiles_repo'), | |||
| r"robot-paths\s* \(E\) = " + os.path.join(test_dir, 'easyconfigs', 'test_ecs'), | |||
| rf"robot-paths\s* \(E\) = {TEST_ECS_DIR}", | |||
| r"rpath\s* \(D\) = " + ('False' if get_os_type() == DARWIN else 'True'), | |||
| r"sourcepath\s* \(E\) = " + os.path.join(test_dir, 'sandbox', 'sources'), | |||
| r"sourcepath-data\s* \(E\) = " + os.path.join(test_dir, 'sandbox', 'data_sources'), | |||
|
enough comments for this time... @Flamefire your turn :-) |
Flamefire
left a comment
There was a problem hiding this comment.
I think I now caught all occurrences. And I found something new for me which greatly simplifies it even more:
Path("foo") / "bar" / "baz" == os.path.join("foo", "bar", "baz")Path("foo/bar") / "baz" == os.path.join("foo", "bar", "baz")Path("foo") / "bar/baz" == Path("foo") / Path("bar/baz") == os.path.join("foo", "bar", "baz")
Hence we can use strings with slash-separators wherever we use Path and save the ', ' or ' / ' "noise"
I can apply this simple S&R (sed -i "s|' / '|/|g") to the other 3 files to make it consistent here (separate commit) or whole separate PR.
| args = ['--search', 'nosuchsoftware-1.2.3.4.5'] | ||
| self.assertRaisesRegex(SystemExit, 'MISSING_EASYCONFIG|4', self.eb_main, args, | ||
| self.assertRaisesRegex(SystemExit, 'MISSING_EASYCONFIG|4', self.eb_main, | ||
| args + ['--search', 'nosuchsoftware-1.2.3.4.5'], |
There was a problem hiding this comment.
I would say this is a bug: every other subtest uses arg + [extra]
Turns out none of them required it: The setup-step sets robot-paths, so I removed args completely
| test_ecs = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'easyconfigs', 'test_ecs') | ||
| test_ecs = TEST_ECS_DIR | ||
| gzip_ec = os.path.join(test_ecs, 'g', 'gzip', 'gzip-1.5-foss-2018a.eb') |
There was a problem hiding this comment.
I missed those, not sure why.
I think a separate PR is to be preferred here. These are difficult enough to review due to size. |
|
But now there are some failed tests, like |
|
I couldn't run the tests on windows powershell yesterday so missed those. Fixed now |
|
@Flamefire merge conflict to fix? |
|
8e9f2c6 to
f720d30
Compare
|
Going in, thanks @Flamefire! |
Followup to #5050
Split from #5203