Skip to content

Commit

Permalink
Merge pull request #2 from JoseHJBlanco/fix-toml-config
Browse files Browse the repository at this point in the history
More TOML tests
  • Loading branch information
JoseHJBlanco authored Apr 25, 2023
2 parents 465c2e5 + 1c4be22 commit 93d5163
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/setup_logging_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_section(self):
'formatter': 'mockformatter',
},
},
'mockloggers': {
'loggers': {
'mocklogger': {
'handlers': ('mockhandler',),
'level': 'INFO',
Expand All @@ -62,6 +62,11 @@ def test_section(self):
result = self.cls._section(None)
self.assertTrue(result)

self.cls.config = LuigiTomlParser()
self.cls.config.read(['./test/testconfig/luigi_logging.toml'])
result = self.cls._section(None)
self.assertTrue(result)

self.cls.config = {}
result = self.cls._section(None)
self.assertFalse(result)
Expand Down
18 changes: 18 additions & 0 deletions test/testconfig/luigi_logging.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[logging]
version = 1
disable_existing_loggers = false

[logging.formatters.mockformatter]
format = "{levelname}: {message}"
style = "{"

[logging.handlers.mockhandler]
class = "logging.StreamHandler"
level = "INFO"
formatter = "mockformatter"

[logging.loggers.mocklogger]
handlers = ["mockhandler"]
level = 'INFO'
disabled = false
propagate = false

0 comments on commit 93d5163

Please sign in to comment.