Files
python/meshtastic/tests/test_analysis.py
Chris Danis b42d33824a Fix pytest test collection on default install
As is, with a default `poetry install`, a simple `poetry pytest run`
will encouter import errors while reading the test files themselves --
which causes pytest to fatally error during test collection, meaning no
tests are run.
2025-03-07 13:16:20 -05:00

30 lines
833 B
Python

"""Test analysis processing."""
import logging
import os
import sys
import pytest
try:
# Depends upon matplotlib & other packages in poetry's analysis group, not installed by default
from meshtastic.analysis.__main__ import main
except ImportError:
pytest.skip("Can't import meshtastic.analysis", allow_module_level=True)
@pytest.mark.unit
def test_analysis(caplog):
"""Test analysis processing"""
cur_dir = os.path.dirname(os.path.abspath(__file__))
slog_input_dir = os.path.join(cur_dir, "slog-test-input")
sys.argv = ["fakescriptname", "--no-server", "--slog", slog_input_dir]
with caplog.at_level(logging.DEBUG):
logging.getLogger().propagate = True # Let our testing framework see our logs
main()
assert "Exiting without running visualization server" in caplog.text