Skip to content

Commit 9bc3063

Browse files
authored
Merge pull request crs4#166 from kikkomep/fix/issue-143
fix(validate): resolve profiles from --extra-profiles-path during validation
2 parents 8306911 + f3a7e6d commit 9bc3063

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

rocrate_validator/models.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,10 @@ def __initialise__(cls, validation_settings: ValidationSettings):
16381638
# extract the validation settings
16391639
severity_validation = validation_settings.requirement_severity
16401640
profiles: list[Profile] = Profile.load_profiles(
1641-
validation_settings.profiles_path, severity=severity_validation)
1641+
validation_settings.profiles_path,
1642+
extra_profiles_path=validation_settings.extra_profiles_path,
1643+
severity=severity_validation,
1644+
allow_requirement_check_override=validation_settings.allow_requirement_check_override)
16421645
profile: Profile = Profile.find_in_list(profiles, validation_settings.profile_identifier)
16431646
target_profile_identifier = profile.identifier
16441647
# initialize the profiles list

tests/unit/test_cli_internals.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,22 @@ def test_compute_stats(fake_profiles_path):
8181
_.requirement.profile.identifier == "a"}
8282

8383
logger.error(stats)
84+
85+
86+
def test_compute_stats_resolves_profile_from_extra_profiles_path(fake_profiles_path):
87+
# ValidationStatistics.__initialise__ used to call Profile.load_profiles
88+
# without forwarding extra_profiles_path, so any profile that lived only
89+
# under --extra-profiles-path raised ProfileNotFound.
90+
settings = ValidationSettings.parse({
91+
"profiles_path": DEFAULT_PROFILES_PATH,
92+
"extra_profiles_path": fake_profiles_path,
93+
"profile_identifier": "a",
94+
"enable_profile_inheritance": True,
95+
"allow_requirement_check_override": True,
96+
"requirement_severity": "REQUIRED",
97+
})
98+
99+
stats = ValidationStatistics.__initialise__(validation_settings=settings)
100+
101+
assert any(p.identifier == "a" for p in stats["profiles"]), \
102+
"Profile 'a' from extra_profiles_path was not resolved by ValidationStatistics"

0 commit comments

Comments
 (0)