22 lines
551 B
Python
22 lines
551 B
Python
#!/usr/bin/python3
|
|
|
|
import pytest
|
|
from wobbl_tools.text.log import Log
|
|
|
|
print("\n==== wobbl_tools.text.log =====")
|
|
|
|
test_log = Log("test_log.txt")
|
|
test_log.clear()
|
|
|
|
test_log.write("Testing the log module...")
|
|
test_log.write("This should be fine...", "ok")
|
|
test_log.write("Something happened...", "warning")
|
|
test_log.write("Oh shit!", "error")
|
|
|
|
print("Logfile contents:")
|
|
print(test_log.read())
|
|
|
|
without_file = Log()
|
|
|
|
with pytest.raises(FileNotFoundError, match="You didn't specify a log path at the log instance definition."):
|
|
without_file.read()
|