Commit 3e8af150 authored by Piergiorgio Pancino's avatar Piergiorgio Pancino
Browse files

utils: resolve RuntimeError: dictionary changed size during iteration

parent 06e1e8c9
Pipeline #13375 passed with stages
in 37 minutes and 8 seconds
......@@ -123,7 +123,7 @@ def replace_reference_by_object(
config, item_cfg_node, ref_objects=None, placeholder=None
):
referenced_objects = ref_objects if ref_objects is not None else dict()
for name, value in item_cfg_node.items():
for name, value in tuple(item_cfg_node.items()):
if _checkref(
config, item_cfg_node, referenced_objects, name, value, placeholder
):
......
......@@ -67,6 +67,24 @@ def test_empty_yml(beacon, beacon_directory):
os.unlink(new_file)
def test_yml_load_error(beacon, beacon_directory):
new_file = "%s/change_size_error.yml" % beacon_directory
try:
with open(new_file, "w") as f:
f.write(
"""- name: change_size_error
a:
b:
- c """
)
beacon.reload()
change_size_error = beacon.get("change_size_error")
finally:
os.unlink(new_file)
@pytest.mark.parametrize(
"object_name, get_func_name, copy, ref_func",
[
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment