Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Christophe Morin <jean_christophe_morin@hotmail.com>
  • Loading branch information
JeanChristopheMorinPerso committed Oct 26, 2024
1 parent c8d5d0c commit 517230a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
51 changes: 51 additions & 0 deletions src/rez/data/tests/contexts/resolved_context-4.8.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"append_sys_path": true,
"arch": "x86_64",
"building": false,
"caching": false,
"created": 1729961872,
"default_patch_lock": "no_lock",
"failure_description": null,
"from_cache": false,
"graph": "{'nodes': [((('fillcolor', '#FFFFAA'), ('fontsize', 10), ('style', 'filled,dashed')), [('_1', 'hello_world')]), ((('fillcolor', '#AAFFAA'), ('fontsize', 10), ('style', 'filled')), [('_2', 'hello_world-1.0[]')])], 'edges': [((('arrowsize', '0.5'),), [('_1', '_2')])]}",
"host": "arch01",
"implicit_packages": [],
"load_time": 0.0,
"num_loaded_packages": 1,
"os": "arch",
"package_cache_async": true,
"package_caching": true,
"package_filter": [],
"package_orderers": null,
"package_paths": [
"/tmp/rez_selftest_ec71iu0a/packages"
],
"package_requests": [
"hello_world"
],
"parent_suite_path": null,
"patch_locks": {},
"platform": "linux",
"requested_timestamp": null,
"resolved_ephemerals": [],
"resolved_packages": [
{
"key": "filesystem.variant",
"variables": {
"index": null,
"location": "/tmp/rez_selftest_ec71iu0a/packages",
"name": "hello_world",
"repository_type": "filesystem",
"version": "1.0"
}
}
],
"rez_path": "/home/jcmorin/jcmenv/aswf/rez/src/rez",
"rez_version": "3.2.0",
"serialize_version": "4.8",
"solve_time": 0.00042057037353515625,
"status": "solved",
"suite_context_name": null,
"timestamp": 1729961872,
"user": "jcmorin"
}
8 changes: 8 additions & 0 deletions src/rez/tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,14 @@ def test_serialize(self):
env = r2.get_environ()
self.assertEqual(env.get("OH_HAI_WORLD"), "hello")

def test_deserialize_older_versions(self):
"""Test deserialization of older contexts."""
baked_contexts_path = self.data_path("contexts")

for context_file in os.listdir(baked_contexts_path):
# load
_ = ResolvedContext.load(os.path.join(baked_contexts_path, context_file))

def test_retarget(self):
"""Test that a retargeted context behaves identically."""
self.inject_python_repo()
Expand Down

0 comments on commit 517230a

Please sign in to comment.