09-11-2025 07:08 AM
Hi all,
I am working on a pyATS/Easypy test automation project where I maintain a shared dictionary across multiple test cases using runtime.synchro.dict.
Here is my setup:
# Initialize shared dictionary in main script
shared_dict = runtime.synchro.dict({
"DUT_IP": ["device1", "device2"],
"EXECUTION_FAILURE": False,
"DEVICE_NAME": [],
"TOTAL_PASSED": 0,
"TOTAL_FAILED": 0,
"TOTAL_TEST_CASES": 0,
"TOTALS": { "PASSED": 0, "FAILED": 0, "ERRORED": 0, "TOTAL": 0 },
"TEST_SUITES": {}, # dict of suite_name -> counters
"SUITES": [] # list of executed suites
})
Inside a test case, I try to append the suite name to the shared list:
Expected behavior:
"test_suite_example" should appear in shared_dict["SUITES"].
Actual behavior:
shared_dict["SUITES"] remains empty ([]) even after append().
Other keys in shared_dict update correctly.
My questions:
Is this a limitation of runtime.synchro.dict regarding nested objects like lists or dicts?
What is the correct way to modify nested lists inside a runtime.synchro.dict during test execution?
Should I switch to using a DB or a JSON dump to persist results across test cases, or can this be safely done in runtime.synchro.dict?
Environment:
pyATS 24.7
Python 3.10
Easypy job with multiple parallel test executions
Any guidance or best practices will be appreciated!
Solved! Go to Solution.
09-11-2025 07:32 AM
I do not think yuou have a limitation here, because self.parameters["shared_dict"]["SUITES"] is a proxy object that does not automatically synchronize with the underlying dict when you call a method like append. I think the workaround is to treat your nested mutable objects as immutable from the perspective of the synchro dict - get them, modify a copy, and reassign the result.
09-11-2025 07:32 AM
I do not think yuou have a limitation here, because self.parameters["shared_dict"]["SUITES"] is a proxy object that does not automatically synchronize with the underlying dict when you call a method like append. I think the workaround is to treat your nested mutable objects as immutable from the perspective of the synchro dict - get them, modify a copy, and reassign the result.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide