Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions test/global/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
class TestLogging:
"""Tests of pymodbus logging."""

LOG_FILE = "pymodbus.log"

@classmethod
def teardown_class(cls):
"""Remove test file."""
if "CI" not in os.environ:
os.remove(cls.LOG_FILE)

def test_log_dont_call_build_msg(self):
"""Verify that build_msg is not called unnecessary."""
with mock.patch("pymodbus.logging.Log.build_msg") as build_msg_mock:
Expand Down Expand Up @@ -48,8 +56,7 @@ def test_log_parms(self, txt, result, params):

def test_apply_logging(self):
"""Test pymodbus_apply_logging_config."""
LOG_FILE = "pymodbus.log"
pymodbus_apply_logging_config("debug", LOG_FILE)
pymodbus_apply_logging_config("debug", self.LOG_FILE)
pymodbus_apply_logging_config("info")
pymodbus_apply_logging_config(logging.NOTSET)
Log.debug("test 1no")
Expand Down Expand Up @@ -86,7 +93,6 @@ def test_apply_logging(self):
Log.info("test 5")
Log.info("test 5")
logging.shutdown()
os.remove(LOG_FILE)


def test_apply_build_no(self):
Expand Down