Skip to content

Commit 2fee464

Browse files
committed
validated mirror tests
1 parent 3eadc82 commit 2fee464

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

unittests/test_mirrors.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,21 @@ def systems_path(test_path):
1414
@pytest.fixture
1515
def valid_mirrors(systems_path):
1616
mirrors = {}
17-
mirrors["fake-mirror"] = {'url': 'https://google.com', 'enabled': True, 'bootstrap': False, 'cache': False, 'mount_specific': False}
18-
mirrors["buildcache-mirror"] = {'url': 'https://cache.spack.io/', 'enabled': True, 'bootstrap': False, 'cache': True, 'mount_specific': False}
17+
mirrors["fake-mirror"] = {'url': 'https://github.com', 'enabled': True, 'bootstrap': False, 'cache': False, 'mount_specific': False}
18+
mirrors["buildcache-mirror"] = {'url': 'https://mirror.spack.io', 'enabled': True, 'bootstrap': False, 'cache': True, 'mount_specific': False}
1919
mirrors["bootstrap-mirror"] = {'url': 'https://mirror.spack.io', 'enabled': True, 'bootstrap': True, 'cache': False, 'mount_specific': False}
2020
return mirrors
2121

2222
def test_mirror_init(systems_path, valid_mirrors):
2323
path = systems_path / "mirror-ok"
24-
#print(path)
2524
mirrors_obj = mirror.Mirrors(path)
26-
#print(mirrors_obj.mirrors.items())
25+
2726
assert mirrors_obj.mirrors == valid_mirrors
28-
assert mirrors_obj.mirrors.bootstrap_mirrors == [mirror for mirror in valid_mirrors.values() if mirror.get('bootstrap')]
29-
assert mirrors_obj.mirrors.build_cache_mirror == [mirror for mirror in valid_mirrors.values() if mirror.get('buildcache')]
30-
# assert disabled mirror not in mirrors
27+
assert mirrors_obj.bootstrap_mirrors == [name for name in valid_mirrors.keys() if valid_mirrors[name].get('bootstrap')]
28+
assert mirrors_obj.build_cache_mirror == [name for name in valid_mirrors.keys() if valid_mirrors[name].get('cache')].pop(0)
29+
3130
for mir in mirrors_obj.mirrors:
32-
assert mir["enabled"]
33-
# test that cmdline_cache gets added to mirrors?
31+
assert mirrors_obj.mirrors[mir].get('enabled')
3432

3533
def test_command_line_cache(systems_path):
3634
"""Check that adding a cache from the command line works."""

0 commit comments

Comments
 (0)