Skip to content

Commit

Permalink
Clear the log handlers on both the root and morpheus logger after eac…
Browse files Browse the repository at this point in the history
…h test (#66)
  • Loading branch information
dagardner-nv authored May 4, 2022
1 parent 8040ef0 commit f5bf0ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ def pytest_collection_modifyitems(items):
item.add_marker(pytest.mark.use_cpp)


def clear_handlers(logger):
handlers = logger.handlers.copy()
for h in handlers:
logger.removeHandler(h)


@pytest.hookimpl(trylast=True)
def pytest_runtest_teardown(item, nextitem):
clear_handlers(logging.getLogger("morpheus"))
clear_handlers(logging.getLogger())


@pytest.fixture(scope="function")
def config_only_cpp():
"""
Expand Down

0 comments on commit f5bf0ff

Please sign in to comment.