Skip to content

Commit

Permalink
Fix the container folder for maya2020 in test data
Browse files Browse the repository at this point in the history
It's recommended to keep each distro's versions in a folder with the same
name as the distro. This also opens the door for newer year releases of maya distros.

Also makes it easier to identify diff issues with the habcache tests.
  • Loading branch information
MHendricks committed Feb 2, 2024
1 parent 535fb03 commit 9f106f4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/site_main_check.habcache
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@
]
}
},
"{config-root}/distros/maya/2020.0/.hab.json": {
"{config-root}/distros/maya2020/2020.0/.hab.json": {
"name": "maya2020",
"environment": {},
"aliases": {
Expand All @@ -1110,7 +1110,7 @@
},
"version": "2020.0"
},
"{config-root}/distros/maya/2020.1/.hab.json": {
"{config-root}/distros/maya2020/2020.1/.hab.json": {
"name": "maya2020",
"version": "2020.1",
"environment": {},
Expand Down
15 changes: 11 additions & 4 deletions tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ def test_site_cache_path(config_root, uncached_resolver, tmpdir):
def test_save_cache(config_root, tmpdir, habcached_resolver):
# Check that the habcache file generated the expected output text
# Note: This file will need updated as the test configuration is updated
check = (config_root / "site_main_check.habcache").open().readlines()
cache = habcached_resolver._test_cache_file.open().readlines()
check_path = config_root / "site_main_check.habcache"
cache_file = habcached_resolver._test_cache_file
check = check_path.open().readlines()
cache = cache_file.open().readlines()
# Add trailing white space to match template file's trailing white space
cache[-1] += "\n"
assert len(cache) == len(check)
assert len(cache) == len(
check
), f"Generated cache does not have the same number of lines: {cache_file}"

for i in range(len(cache)):
assert cache[i] == check[i]
assert (
cache[i] == check[i]
), f"Difference on line: {i} between the generated cache and {check_path}."


def test_load_cache(config_root, uncached_resolver, habcached_site_file):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_distro_parse(config_root, resolver):
# Verify that if the json file doesn't have "version" defined it uses the
# parent directory as its version.
app = DistroVersion(forest, resolver)
path = config_root / "distros" / "maya" / "2020.0" / ".hab.json"
path = config_root / "distros" / "maya2020" / "2020.0" / ".hab.json"
app.load(path)
check = json.load(path.open())

Expand Down

0 comments on commit 9f106f4

Please sign in to comment.