Skip to content

Commit

Permalink
Merge pull request #37 from tac0x2a/fix/keep_running_if_no_config
Browse files Browse the repository at this point in the history
Fix keep running if no config files
  • Loading branch information
tac0x2a authored Sep 22, 2020
2 parents 2e79bc0 + a7b3bb6 commit 92a7764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion onamazu/onamazu.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __load_config(self):
self.logger.info(f'config_map={config_map}')

if len(config_map) == 0:
raise Exception("No config file found. Please see README.md")
self.logger.warning(f"No config files ({config.ConfigFileName}) are found. Please see README.md")

return config_map

Expand Down
9 changes: 9 additions & 0 deletions tests/test_reload_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
from onamazu.watcher import NamazuEvent


def test_return_empty_when_no_config_file():
o = ONamazu(ct.ROOT_DIR, 60)
o.event_handler = MagicMock(name="event_handler")
o.click()
o.stop()

o.event_handler.assert_not_called()


class TestReload:
def test_reload_on_create(self):
ct.place_config_file("", {"pattern": "*.csv"})
Expand Down

0 comments on commit 92a7764

Please sign in to comment.