Skip to content

Commit

Permalink
Add test.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed May 1, 2024
1 parent 966e669 commit efabfc8
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/tests/test_general.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import logging

import pytest

import fancylog

lateral_separator = "**************"
Expand Down Expand Up @@ -38,3 +40,19 @@ def test_logger_name(tmp_path):
fancylog.start_logging(tmp_path, fancylog, logger_name=logger_name)

assert logger_name in logging.root.manager.loggerDict


def test_assert_named_logger_with_multiprocessing(tmp_path):
"""
Test an error is raised if trying to use multiprocess
logging with a named logger.
"""
with pytest.raises(ValueError) as e:
fancylog.start_logging(
tmp_path,
fancylog,
logger_name="hello_world",
multiprocessing_aware=True,
)

assert "root logger" in str(e.value)

0 comments on commit efabfc8

Please sign in to comment.