Skip to content

Commit 9cd02bb

Browse files
committed
Review comments - check for key without equals sign
1 parent 78038ed commit 9cd02bb

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

easybuild/framework/easyconfig/easyconfig.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,13 +1238,13 @@ def find_dep_version_match(self, dep):
12381238
# figure out matches based on dict keys (after splitting on '=')
12391239
my_arch_key = 'arch=%s' % get_cpu_architecture()
12401240
arch_keys = [x for x in dep['version'].keys() if x.startswith('arch=')]
1241-
other_keys = [x for x in dep['version'].keys() if '=' in x and x not in arch_keys]
1241+
other_keys = [x for x in dep['version'].keys() if x not in arch_keys]
12421242
if other_keys:
12431243
raise EasyBuildError("Unexpected keys in version: %s. Only 'arch=' keys are supported", other_keys)
12441244
if arch_keys:
12451245
if my_arch_key in dep['version']:
12461246
ver = dep['version'][my_arch_key]
1247-
self.log.info("Version selected from %s: %s", dep['version'], ver)
1247+
self.log.info("Version selected from %s using key %s: %s", dep['version'], my_arch_key, ver)
12481248
return ver
12491249
else:
12501250
raise EasyBuildError("No matches for version in %s (looking for %s)", dep['version'], my_arch_key)

test/framework/easyconfig.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,21 +3163,22 @@ def test_unexpected_version_keys_caught(self):
31633163

31643164
my_arch = st.get_cpu_architecture()
31653165
expected_version = '1.2.3'
3166-
dep_str = "[('foo', {'bar=%s': '%s', 'arch=Foo': 'bar'})]" % (my_arch, expected_version)
31673166

3168-
test_ec = os.path.join(self.test_prefix, 'test.eb')
3169-
test_ectxt = '\n'.join([
3170-
"easyblock = 'ConfigureMake'",
3171-
"name = 'test'",
3172-
"version = '0.2'",
3173-
"homepage = 'https://example.com'",
3174-
"description = 'test'",
3175-
"toolchain = SYSTEM",
3176-
"dependencies = %s" % dep_str,
3177-
])
3178-
write_file(test_ec, test_ectxt)
3167+
for dep_str in ("[('foo', {'bar=%s': '%s', 'arch=Foo': 'bar'})]" % (my_arch, expected_version),
3168+
"[('foo', {'blah': 'bar'})]"):
3169+
test_ec = os.path.join(self.test_prefix, 'test.eb')
3170+
test_ectxt = '\n'.join([
3171+
"easyblock = 'ConfigureMake'",
3172+
"name = 'test'",
3173+
"version = '0.2'",
3174+
"homepage = 'https://example.com'",
3175+
"description = 'test'",
3176+
"toolchain = SYSTEM",
3177+
"dependencies = %s" % dep_str,
3178+
])
3179+
write_file(test_ec, test_ectxt)
31793180

3180-
self.assertRaises(EasyBuildError, EasyConfig, test_ec)
3181+
self.assertRaises(EasyBuildError, EasyConfig, test_ec)
31813182

31823183

31833184
def suite():

0 commit comments

Comments
 (0)