Skip to content

Commit

Permalink
tests(manager): Do not parametrize tests that require teardown of a f…
Browse files Browse the repository at this point in the history
…ile for compatibility on windows CI.
  • Loading branch information
Spill-Tea committed Dec 7, 2024
1 parent 5980ab2 commit 1f3aa4a
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,27 @@ def test_level_error(build_manager: Callable[..., EpiLog]) -> None:
build_manager(level=-1)


@pytest.mark.parametrize(
"handler",
[
logging.FileHandler("test.log"),
logging.StreamHandler(),
],
)
def test_handlers_instantiation(handler, build_manager: Callable[..., EpiLog]) -> None:
def _confirm_handler_instantiation(
handler: logging.Handler,
constructor: Callable[..., EpiLog],
) -> None:
"""Tests Expected instantiation Behavior of EpiLog class with stream."""
manager: EpiLog = build_manager(stream=handler)
manager: EpiLog = constructor(stream=handler)
assert manager.stream == handler, "Expected Stream to reflect input."


def test_streamhandler_instantiation(build_manager: Callable[..., EpiLog]) -> None:
"""Tests Expected instantiation Behavior of EpiLog class with stream handler."""
stream = logging.StreamHandler()
_confirm_handler_instantiation(stream, build_manager)


def test_filehandler_instantiation(build_manager: Callable[..., EpiLog]) -> None:
"""Tests Expected instantiation Behavior of EpiLog class with file handler."""
stream = logging.FileHandler("test.log")
_confirm_handler_instantiation(stream, build_manager)


def test_handlers_error(build_manager: Callable[..., EpiLog]) -> None:
"""Tests that a TypeError is raised when instantiating invalid stream."""
with pytest.raises(TypeError):
Expand Down

0 comments on commit 1f3aa4a

Please sign in to comment.