Add __test__ = False to Test*-prefixed domain model classes

Pytest's default collection pattern matches any class starting with
"Test". These domain models (TestType, TestResults, TestFiles, etc.)
are not test classes — mark them explicitly so pytest skips them.
This commit is contained in:
Kevin Turcios 2026-04-23 04:41:18 -05:00
parent 4f98b5421f
commit 76a07c7f66
6 changed files with 36 additions and 0 deletions

View file

@ -14,6 +14,8 @@ class TestGenRequest(BaseModel):
Request body for POST /ai/testgen.
"""
__test__ = False
source_code_being_tested: str
function_name: str
module_path: str
@ -50,6 +52,8 @@ class TestGenResponse(BaseModel):
Successful response from POST /ai/testgen.
"""
__test__ = False
generated_tests: str
raw_generated_tests: str | None = None
@ -59,6 +63,8 @@ class TestGenErrorResponse(BaseModel):
Error response from testgen endpoints.
"""
__test__ = False
error: str
trace_id: str | None = None
@ -71,6 +77,8 @@ class TestSourceWithFailures(BaseModel):
A test source file with optional behavioral test failures.
"""
__test__ = False
test_source: str
test_index: int
failed_test_functions: list[str] = []
@ -107,6 +115,8 @@ class TestgenReviewRequest(BaseModel):
Request body for POST /ai/testgen_review.
"""
__test__ = False
tests: list[TestSourceWithFailures]
function_source_code: str
function_name: str
@ -133,6 +143,8 @@ class TestReview(BaseModel):
Review result for one test source.
"""
__test__ = False
test_index: int
functions: list[FunctionVerdict]
@ -142,6 +154,8 @@ class TestgenReviewResponse(BaseModel):
Response from POST /ai/testgen_review.
"""
__test__ = False
reviews: list[TestReview]
@ -162,6 +176,8 @@ class TestRepairRequest(BaseModel):
Request body for POST /ai/testgen_repair.
"""
__test__ = False
test_source: str
functions_to_repair: list[FunctionToRepair]
function_source_code: str
@ -199,4 +215,6 @@ class TestRepairResponse(BaseModel):
Response from POST /ai/testgen_repair.
"""
__test__ = False
generated_tests: str

View file

@ -131,6 +131,8 @@ class FunctionToOptimize:
class TestingMode(enum.Enum):
"""Mode for test instrumentation."""
__test__ = False
BEHAVIOR = "behavior"
PERFORMANCE = "performance"
LINE_PROFILE = "line_profile"

View file

@ -43,6 +43,8 @@ FUNCTION_NAME_REGEX = re.compile(
class TestFunction:
"""A test function discovered within a test file."""
__test__ = False
function_name: str
test_class: str | None
parameters: str | None

View file

@ -11,6 +11,8 @@ import attrs
class TestType(enum.IntEnum):
"""Type of test discovered."""
__test__ = False
EXISTING_UNIT_TEST = 1
INSPIRED_REGRESSION = 2
GENERATED_REGRESSION = 3
@ -44,6 +46,8 @@ class CodePosition:
class TestsInFile:
"""A test function found in a test file."""
__test__ = False
test_file: Path = attrs.field(converter=Path)
test_class: str | None
test_function: str

View file

@ -56,6 +56,8 @@ class GeneratedTestsList:
class TestgenPayload:
"""Typed payload for the ``/ai/testgen`` endpoint."""
__test__ = False
source_code_being_tested: str
function_to_optimize: dict[str, object]
helper_function_names: list[str]

View file

@ -156,6 +156,8 @@ class FunctionTestInvocation:
class TestResults:
"""Collection of test invocation results."""
__test__ = False
test_results: list[FunctionTestInvocation] = attrs.Factory(list)
test_result_idx: dict[str, int] = attrs.Factory(dict)
perf_stdout: str | None = None
@ -324,6 +326,8 @@ class TestResults:
class TestFile:
"""A test file ready for execution."""
__test__ = False
original_file_path: Path = attrs.field(converter=Path)
instrumented_behavior_file_path: Path | None = None
benchmarking_file_path: Path | None = None
@ -335,6 +339,8 @@ class TestFile:
class TestFiles:
"""Collection of test files for a test run."""
__test__ = False
test_files: list[TestFile] = attrs.Factory(list)
def get_test_type_by_instrumented_file_path(
@ -372,6 +378,8 @@ class TestFiles:
class TestConfig:
"""Configuration for test execution."""
__test__ = False
tests_project_rootdir: Path = attrs.field(converter=Path)
test_framework: str = "pytest"
pytest_cmd: str = "pytest"