testsAndMisc/python_pkg/fm24_searcher/tests/test_main.py
Krzysztof kuhy Rudnicki f6b6995b0e Add tests and fix pre-commit issues across all projects
- C/lichess_random_engine, vocabulary_curve, misc/split,
  1dvelocitysimulator, opening_learner: test suites added
- CPP/miscelanious: tests added
- TS/battery-status, champions_leauge_scores, two-inputs: tests added
- python_pkg/fm24_searcher, wake_alarm: new packages added
- Fix ruff/cppcheck/eslint/clang-format failures
- Update .gitignore for C/C++ build artifacts
2026-04-12 20:45:24 +02:00

37 lines
950 B
Python

"""Tests for python_pkg.fm24_searcher.__main__."""
from __future__ import annotations
from unittest.mock import patch
import pytest
from python_pkg.fm24_searcher.__main__ import _main
class TestMain:
"""__main__ dispatch tests."""
def test_dump_mode(self) -> None:
with (
patch("sys.argv", ["fm24", "--dump", "--db", "/nonexistent"]),
patch(
"python_pkg.fm24_searcher.cli.run_dump",
return_value=0,
) as mock_dump,
):
with pytest.raises(SystemExit) as exc_info:
_main()
assert exc_info.value.code == 0
mock_dump.assert_called_once()
def test_gui_mode(self) -> None:
with (
patch("sys.argv", ["fm24"]),
patch(
"python_pkg.fm24_searcher.gui.main",
) as mock_gui,
):
_main()
mock_gui.assert_called_once()