This directory contains tests for the pushlog daemon. The tests cover the various components and functionality of the application.
test_config.py: Tests for configuration loading and parsingtest_pattern_matching.py: Tests for unit matching, pattern matching, and fuzzy deduplicationtest_notifications.py: Tests for message formatting and sending notificationstest_history.py: Tests for history buffer management and cleanuptest_daemon.py: Tests for the main daemon functionality with mocked components
To run all tests:
pytestTo run a specific test file:
pytest tests/test_config.pyTo run a specific test case:
pytest tests/test_config.py::TestConfig::test_load_configTo run with coverage:
pytest --cov=pushlog_libYou can install the test dependencies with:
pip install -e ".[dev]"The test configuration file (fixtures/test_config.yaml) contains a sample configuration for testing, including various units, patterns, and priority mappings.
The tests use Python's unittest.mock module to mock external dependencies such as:
systemd.journal.Readerfor journal accessHTTPSConnectionfor Pushover API callsdatetimefor time-based tests
This allows the tests to run without requiring actual system journal access or making actual API calls.