Skip to content

[6/6] Use constants for commonly used test easyconfig folders, files and content - #5251

Merged
akesandgren merged 5 commits into
easybuilders:developfrom
Flamefire:toy-and-test-dir-constants-6
Oct 7, 2026
Merged

akesandgren merged 5 commits into
easybuilders:developfrom
Flamefire:toy-and-test-dir-constants-6

Conversation

@Flamefire

Copy link
Copy Markdown
Contributor

Followup to #5050

Split from #5203

@boegel

boegel commented Sep 3, 2026

Copy link
Copy Markdown
Member

@Flamefire needs rebase after merge of #5255

@Flamefire
Flamefire force-pushed the toy-and-test-dir-constants-6 branch from 6bb5e6a to 397961c Compare September 4, 2026 09:15
@boegel boegel added this to the next release (5.4.1?) milestone Sep 4, 2026
@Flamefire
Flamefire force-pushed the toy-and-test-dir-constants-6 branch 4 times, most recently from 64a4141 to 107e815 Compare September 11, 2026 13:38
@akesandgren

Copy link
Copy Markdown
Contributor

@Flamefire conflict to solve

@Flamefire
Flamefire force-pushed the toy-and-test-dir-constants-6 branch from 107e815 to bf3122b Compare September 21, 2026 11:42
@Flamefire

Copy link
Copy Markdown
Contributor Author

Done, CI passed again :)

@Flamefire
Flamefire force-pushed the toy-and-test-dir-constants-6 branch 3 times, most recently from 3cf82b7 to bda983a Compare October 5, 2026 08:30
Comment thread test/framework/options.py Outdated
Comment on lines +1187 to +1146
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'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking --robot=... should not be part of args here so this one should probably be reverted

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread test/framework/options.py Outdated
Comment on lines 1799 to 1752
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')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not go all the way here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed those, not sure why.

Comment thread test/framework/options.py Outdated
Comment on lines 2121 to 2076
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'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why not all the way here too (and the rest of the test_ecs_path instances below)

Comment thread test/framework/options.py Outdated
Comment on lines 2986 to 2991
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'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not all the way with test_dir?

Comment thread test/framework/options.py Outdated
Comment on lines 3278 to 3288

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here test_ecs_path -> TEST_ECS_DIR

Comment thread test/framework/options.py Outdated
Comment on lines 5203 to 5219
@@ -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'),

@akesandgren akesandgren Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_dir -> TEST_DIR

@akesandgren

akesandgren commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

enough comments for this time... @Flamefire your turn :-)

@Flamefire Flamefire left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread test/framework/options.py Outdated
Comment on lines +1187 to +1146
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'],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread test/framework/options.py Outdated
Comment on lines 1799 to 1752
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')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed those, not sure why.

@akesandgren

Copy link
Copy Markdown
Contributor

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.

I think a separate PR is to be preferred here. These are difficult enough to review due to size.

@akesandgren

akesandgren commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

But now there are some failed tests, like

  File "/tmp/runner/10f6800a31437f4ccc896db4bb2f21b83fee7e3b/lib/python3.6/site-packages/test/framework/options.py", line 509, in test_job
271
    check_args(['--debug'])
272
  File "/tmp/runner/10f6800a31437f4ccc896db4bb2f21b83fee7e3b/lib/python3.6/site-packages/test/framework/options.py", line 501, in check_args
273
    msgstrs = [(tweaked_eb_file, eb_file + try_opts)]
274
TypeError: unsupported operand type(s) for +: 'PosixPath' and 'str'

@Flamefire

Copy link
Copy Markdown
Contributor Author

I couldn't run the tests on windows powershell yesterday so missed those. Fixed now

@boegel

boegel commented Oct 7, 2026

Copy link
Copy Markdown
Member

@Flamefire merge conflict to fix?

@Flamefire

Flamefire commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor Author

I think a separate PR is to be preferred here. These are difficult enough to review due to size.

@boegel boegel modified the milestones: next release (5.4.1), 5.x Oct 7, 2026
@Flamefire
Flamefire force-pushed the toy-and-test-dir-constants-6 branch from 8e9f2c6 to f720d30 Compare October 7, 2026 07:40

@akesandgren akesandgren left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akesandgren

Copy link
Copy Markdown
Contributor

Going in, thanks @Flamefire!

@akesandgren
akesandgren merged commit 2f33d74 into easybuilders:develop Oct 7, 2026
41 checks passed
@akesandgren akesandgren modified the milestones: 5.x, next release (5.4.1) Oct 7, 2026
@Flamefire
Flamefire deleted the toy-and-test-dir-constants-6 branch October 7, 2026 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants