Repository navigation
test: cover conf module - #27
Merged
Merged
Conversation
Signed-off-by: zomop <1.80929302e+08+zomop@users.noreply.github.com>
marcos-mendez
approved these changes
Oct 4, 2026
marcos-mendez
left a comment
Collaborator
There was a problem hiding this comment.
Hi @zomop, thanks a lot for this, and welcome to Keel Linux!
I ran it locally: all 13 new tests pass, the full confconsole suite passes, and conf.py goes from 0% to 100% line and branch coverage, so adding conf to the 100% gate is right. The tests are clear, well named, and check real behaviour (parsing, rejecting bad lines, keeping comments when writing). That is exactly what we want.
Two small things, not blockers, but worth knowing for next time:
Testing through the public interface. test_load_conf_ignores_a_missing_explicit_file and test_set_default_nic_creates_a_missing_configuration_file build the object with object.__new__ and call _load_conf() directly. That ties the test to the class's internals: if someone refactors Conf.__init__, these tests break even though the behaviour is the same. A sturdier way is to reach the same case through the public path. For example, point conf.path at a temporary directory with monkeypatch, then call conf.Conf(), so the test only knows what a user of the module knows.
Don't freeze surprising behaviour; flag it. test_set_default_nic_replaces_existing_setting_and_preserves_other_lines asserts that when default_nic appears twice, both lines get rewritten. That is what the code does today, but it is probably not what anyone intended: the duplicate should likely collapse to one line. When a test uncovers behaviour like this, it is better to keep the test to the clear case and open an issue describing the oddity, so the test doesn't lock a bug in place. Would you like to open that issue?
Once CI is green I'll merge. Thanks again, and feel free to pick up another good first issue, or ask anything in Discussions.
Author
|
Thanks so much for the detailed review and feedback! Really appreciate it, and I’m glad to have contributed to Keel Linux! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.