Skip to content

Commit

Permalink
Merge pull request #79 from akaihola/test-load-config
Browse files Browse the repository at this point in the history
Test all options in `load_config()`
  • Loading branch information
akaihola authored Oct 5, 2024
2 parents 178e6f3 + 28d3b8c commit 80fc2de
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ These features will be included in the next release:

Added
-----
- Unit test for ``log_level`` option for `darkgraylib.config.load_config`.
- Unit tests of configuration file options for `darkgraylib.config.load_config`.

Fixed
-----
Expand Down
13 changes: 13 additions & 0 deletions src/darkgraylib/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,13 @@ def test_dump_config(config, expect):
["config", "expect"],
[
("", {}),
("src = []", {"src": []}),
("src = ['your.py']", {"src": ["your.py"]}),
("revision = 'your-branch'", {"revision": "your-branch"}),
("stdout = false", {"stdout": False}),
("stdout = true", {"stdout": True}),
("stdout = no", TomlDecodeError),
("config = 'your.conf'", {"config": "your.conf"}),
("log_level = 0", {"log_level": "NOTSET"}),
("log_level = 'NOTSET'", {"log_level": "NOTSET"}),
("log_level = 1", {"log_level": "Level 1"}),
Expand All @@ -535,6 +542,12 @@ def test_dump_config(config, expect):
("log_level = 'ERROR'", {"log_level": "ERROR"}),
("log_level = 50", {"log_level": "CRITICAL"}),
("log_level = 'CRITICAL'", {"log_level": "CRITICAL"}),
("color = false", {"color": False}),
("color = true", {"color": True}),
("workers = 0", {"workers": 0}),
("workers = 1", {"workers": 1}),
("workers = 42", {"workers": 42}),
("invalid_option = 42", ConfigurationError),
],
)
def test_load_config(tmp_path, monkeypatch, config, expect):
Expand Down

0 comments on commit 80fc2de

Please sign in to comment.