- assert not errors, "Error parsing file {} with error {}".format(filename, errors)
- else:
- pytest.skip("The file does not have any of the extensions .yml,\
- .yaml, or .env")
+def check_duplicate_keys(yaml_path):
+ import yaml as normal_yaml
+
+ try:
+ with open(yaml_path) as fh:
+ normal_yaml.load(fh, yaml_custom_utils.UniqueKeyLoader) # nosec
+ except ConstructorError as e:
+ pytest.fail("{} {}".format(e.problem, e.problem_mark))
+
+
+@pytest.mark.base
+@validates("R-92635")
+def test_02_no_duplicate_keys_in_file(yaml_file):
+ check_duplicate_keys(yaml_file)