Skip to content

test: cover conf module - #27

Merged
marcos-mendez merged 1 commit into
Keel-Linux:masterfrom
zomop:test/25-cover-conf-module
Oct 4, 2026
Merged

marcos-mendez merged 1 commit into
Keel-Linux:masterfrom
zomop:test/25-cover-conf-module

Conversation

@zomop

@zomop zomop commented Oct 3, 2026

Copy link
Copy Markdown

No description provided.

Signed-off-by: zomop <1.80929302e+08+zomop@users.noreply.github.com>

@marcos-mendez marcos-mendez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@marcos-mendez
marcos-mendez merged commit 4d345eb into Keel-Linux:master Oct 4, 2026
2 checks passed
@zomop

zomop commented Oct 4, 2026

Copy link
Copy Markdown
Author

Thanks so much for the detailed review and feedback! Really appreciate it, and I’m glad to have contributed to Keel Linux!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants