Files
freecad-robust-mcp-fc111/tests/just_commands/test_testing.py
T
Sean P. KaneandGitHub f14ab8177d Fix: rename workbench and prepare for release (#27)
* chore: rename workbench to FreecadRobustMCPBridge

* fix: stdio cleanup and bug fix for JSON RPC

* fix: update FreeCAD MCP bridge and tests

* test: Fix GUI Integration tests and other issues

* fix: unit tests in CI and a few other things

* docs: generate GitHub pages site and link to it.

* fix: General code improvements and DRY refactoring

* chore: General cleanup

* chore: small fixes

* docs: cleanup

* docs: fixes

* docs: small corrections

* docs: fix

* test: release check

* bump: workbench v0.6.0

* chore: bump macros to 0.6.0

* docs: Release improvements

* refactor: improve DRYness of code
2026-01-12 09:30:05 -08:00

84 lines
2.8 KiB
Python

"""Tests for testing module just commands.
These tests verify that test commands work correctly.
Note: We avoid running integration tests here to prevent recursion.
"""
from __future__ import annotations
from typing import TYPE_CHECKING, ClassVar
import pytest
from tests.just_commands.conftest import assert_command_executed
if TYPE_CHECKING:
from tests.just_commands.conftest import JustRunner
class TestTestingSyntax:
"""Syntax validation tests for testing commands."""
TESTING_COMMANDS: ClassVar[list[str]] = [
"testing::unit",
"testing::cov",
"testing::fast",
"testing::integration",
"testing::verbose",
"testing::all",
"testing::watch",
"testing::integration-freecad-auto",
"testing::just-syntax",
"testing::just-runtime",
"testing::just-all",
"testing::just-release",
"testing::release-test",
"testing::integration-headless-release",
"testing::integration-gui-release",
"testing::kill-bridge",
]
@pytest.mark.just_syntax
@pytest.mark.parametrize("command", TESTING_COMMANDS)
def test_testing_command_syntax(self, just: JustRunner, command: str) -> None:
"""Testing command should have valid syntax."""
result = just.dry_run(command)
assert result.success, f"Syntax error in '{command}': {result.stderr}"
class TestTestingRuntime:
"""Runtime tests for testing commands.
Note: We use --collect-only or run minimal tests to avoid
long execution times and recursion issues.
"""
@pytest.mark.just_runtime
def test_kill_bridge_runs(self, just: JustRunner) -> None:
"""Kill-bridge command should run (even if nothing to kill)."""
result = just.run("testing::kill-bridge", timeout=30)
# Should succeed even if no processes to kill
assert result.success, f"Kill-bridge failed: {result.stderr}"
@pytest.mark.just_runtime
def test_unit_command_recognizes_pytest(self, just: JustRunner) -> None:
"""Unit test command should at least recognize pytest."""
# Run with --collect-only to just validate pytest setup
result = just.run(
"testing::unit",
timeout=60,
env={"PYTEST_ADDOPTS": "--collect-only -q"},
)
# Should at least find some tests or run without error
assert_command_executed(result, "testing::unit")
@pytest.mark.just_runtime
def test_fast_command_recognizes_markers(self, just: JustRunner) -> None:
"""Fast test command should recognize the 'not slow' marker."""
result = just.run(
"testing::fast",
timeout=60,
env={"PYTEST_ADDOPTS": "--collect-only -q"},
)
assert_command_executed(result, "testing::fast")