-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update broken OmegaConfigLoader test #3696
Conversation
Close #3287. Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Juan Luis Cano Rodríguez <juan_luis_cano@mckinsey.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <90615669+AhdraMeraliQB@users.noreply.github.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <90615669+AhdraMeraliQB@users.noreply.github.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not qualified to comment on this one 😅
Signed-off-by: Ahdra Merali <90615669+AhdraMeraliQB@users.noreply.github.com>
# Assert any specific config file was only loaded once | ||
expected_path = (tmp_path / "dev" / "user1" / "catalog2.yml").resolve() | ||
load_spy.assert_called_once_with(expected_path) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this removed?
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
Signed-off-by: Ahdra Merali <ahdra.merali@quantumblack.com>
def test_overlapping_patterns_in_same_env(self, tmp_path, mocker): | ||
"""Check that configuration files that match several patterns are only loaded once in each env.""" | ||
_write_yaml( | ||
tmp_path / _BASE_ENV / "catalog0.yml", | ||
{"env": "base", "common": "common"}, | ||
) | ||
_write_yaml(tmp_path / _BASE_ENV / "user1" / "catalog2.yml", {"user1_c2": True}) | ||
|
||
catalog_patterns = { | ||
"catalog": [ | ||
"catalog*", | ||
"user1/catalog*", | ||
"*/catalog2*", | ||
] | ||
} | ||
|
||
load_spy = mocker.spy(OmegaConf, "load") | ||
catalog = OmegaConfigLoader( | ||
conf_source=str(tmp_path), | ||
base_env=_BASE_ENV, | ||
config_patterns=catalog_patterns, | ||
)["catalog"] | ||
expected_catalog = { | ||
"env": "base", | ||
"common": "common", | ||
"user1_c2": True, | ||
} | ||
assert catalog == expected_catalog | ||
|
||
# Assert load is only called once for each file | ||
assert load_spy.call_count == 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it and it works fine. I think one improvement we can make is simply remove anything about catalog0.yml
, since the test is focusing on the deduplication, only catalog 2 is being scan twice but read once. It also make the test simpler.
Description
In #3587 it was pointed out that the test
test_overlapping_patterns
contained an assert statement that was passing trivially. Correcting this assert showed that the logic being tested was redundant, a remnant from the previous ConfigLoader setup that was not carried over to the OmegaConfigLoader. As a result, this assert statement has been removed.Development notes
The test coverage is unaffected by this removal.
Developer Certificate of Origin
We need all contributions to comply with the Developer Certificate of Origin (DCO). All commits must be signed off by including a
Signed-off-by
line in the commit message. See our wiki for guidance.If your PR is blocked due to unsigned commits, then you must follow the instructions under "Rebase the branch" on the GitHub Checks page for your PR. This will retroactively add the sign-off to all unsigned commits and allow the DCO check to pass.
Checklist
RELEASE.md
file