-
- if not any(map(lambda v: v in yml, key_values)):
- pytest.skip('The fixture is not applicable for this test')
-
- is_dict = 0
- should_be_dict = 0
- is_not_dict = 0
- should_not_be_dict = 0
- for key_value in key_values:
- if key_value in yml:
- if isinstance(yml[key_value], dict):
- is_dict += 1
- if key_value not in key_values_not_dicts:
- should_be_dict += 1
- elif not isinstance(yml[key_value], list):
- is_not_dict += 1
- if key_value in key_values_not_dicts:
- should_not_be_dict += 1
- assert (is_dict == should_be_dict and
- is_not_dict == should_not_be_dict)
+ missing_keys = [v for v in required_keys if v not in yml]
+ assert not missing_keys, "%s missing %s" % (env_file, missing_keys)