mirror of
https://github.com/codeflash-ai/codeflash-agent.git
synced 2026-05-04 18:25:19 +00:00
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:
parent
4f98b5421f
commit
76a07c7f66
6 changed files with 36 additions and 0 deletions
|
|
@ -14,6 +14,8 @@ class TestGenRequest(BaseModel):
|
||||||
Request body for POST /ai/testgen.
|
Request body for POST /ai/testgen.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
source_code_being_tested: str
|
source_code_being_tested: str
|
||||||
function_name: str
|
function_name: str
|
||||||
module_path: str
|
module_path: str
|
||||||
|
|
@ -50,6 +52,8 @@ class TestGenResponse(BaseModel):
|
||||||
Successful response from POST /ai/testgen.
|
Successful response from POST /ai/testgen.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
generated_tests: str
|
generated_tests: str
|
||||||
raw_generated_tests: str | None = None
|
raw_generated_tests: str | None = None
|
||||||
|
|
||||||
|
|
@ -59,6 +63,8 @@ class TestGenErrorResponse(BaseModel):
|
||||||
Error response from testgen endpoints.
|
Error response from testgen endpoints.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
error: str
|
error: str
|
||||||
trace_id: str | None = None
|
trace_id: str | None = None
|
||||||
|
|
||||||
|
|
@ -71,6 +77,8 @@ class TestSourceWithFailures(BaseModel):
|
||||||
A test source file with optional behavioral test failures.
|
A test source file with optional behavioral test failures.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_source: str
|
test_source: str
|
||||||
test_index: int
|
test_index: int
|
||||||
failed_test_functions: list[str] = []
|
failed_test_functions: list[str] = []
|
||||||
|
|
@ -107,6 +115,8 @@ class TestgenReviewRequest(BaseModel):
|
||||||
Request body for POST /ai/testgen_review.
|
Request body for POST /ai/testgen_review.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
tests: list[TestSourceWithFailures]
|
tests: list[TestSourceWithFailures]
|
||||||
function_source_code: str
|
function_source_code: str
|
||||||
function_name: str
|
function_name: str
|
||||||
|
|
@ -133,6 +143,8 @@ class TestReview(BaseModel):
|
||||||
Review result for one test source.
|
Review result for one test source.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_index: int
|
test_index: int
|
||||||
functions: list[FunctionVerdict]
|
functions: list[FunctionVerdict]
|
||||||
|
|
||||||
|
|
@ -142,6 +154,8 @@ class TestgenReviewResponse(BaseModel):
|
||||||
Response from POST /ai/testgen_review.
|
Response from POST /ai/testgen_review.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
reviews: list[TestReview]
|
reviews: list[TestReview]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -162,6 +176,8 @@ class TestRepairRequest(BaseModel):
|
||||||
Request body for POST /ai/testgen_repair.
|
Request body for POST /ai/testgen_repair.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_source: str
|
test_source: str
|
||||||
functions_to_repair: list[FunctionToRepair]
|
functions_to_repair: list[FunctionToRepair]
|
||||||
function_source_code: str
|
function_source_code: str
|
||||||
|
|
@ -199,4 +215,6 @@ class TestRepairResponse(BaseModel):
|
||||||
Response from POST /ai/testgen_repair.
|
Response from POST /ai/testgen_repair.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
generated_tests: str
|
generated_tests: str
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,8 @@ class FunctionToOptimize:
|
||||||
class TestingMode(enum.Enum):
|
class TestingMode(enum.Enum):
|
||||||
"""Mode for test instrumentation."""
|
"""Mode for test instrumentation."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
BEHAVIOR = "behavior"
|
BEHAVIOR = "behavior"
|
||||||
PERFORMANCE = "performance"
|
PERFORMANCE = "performance"
|
||||||
LINE_PROFILE = "line_profile"
|
LINE_PROFILE = "line_profile"
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ FUNCTION_NAME_REGEX = re.compile(
|
||||||
class TestFunction:
|
class TestFunction:
|
||||||
"""A test function discovered within a test file."""
|
"""A test function discovered within a test file."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
function_name: str
|
function_name: str
|
||||||
test_class: str | None
|
test_class: str | None
|
||||||
parameters: str | None
|
parameters: str | None
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import attrs
|
||||||
class TestType(enum.IntEnum):
|
class TestType(enum.IntEnum):
|
||||||
"""Type of test discovered."""
|
"""Type of test discovered."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
EXISTING_UNIT_TEST = 1
|
EXISTING_UNIT_TEST = 1
|
||||||
INSPIRED_REGRESSION = 2
|
INSPIRED_REGRESSION = 2
|
||||||
GENERATED_REGRESSION = 3
|
GENERATED_REGRESSION = 3
|
||||||
|
|
@ -44,6 +46,8 @@ class CodePosition:
|
||||||
class TestsInFile:
|
class TestsInFile:
|
||||||
"""A test function found in a test file."""
|
"""A test function found in a test file."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_file: Path = attrs.field(converter=Path)
|
test_file: Path = attrs.field(converter=Path)
|
||||||
test_class: str | None
|
test_class: str | None
|
||||||
test_function: str
|
test_function: str
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ class GeneratedTestsList:
|
||||||
class TestgenPayload:
|
class TestgenPayload:
|
||||||
"""Typed payload for the ``/ai/testgen`` endpoint."""
|
"""Typed payload for the ``/ai/testgen`` endpoint."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
source_code_being_tested: str
|
source_code_being_tested: str
|
||||||
function_to_optimize: dict[str, object]
|
function_to_optimize: dict[str, object]
|
||||||
helper_function_names: list[str]
|
helper_function_names: list[str]
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,8 @@ class FunctionTestInvocation:
|
||||||
class TestResults:
|
class TestResults:
|
||||||
"""Collection of test invocation results."""
|
"""Collection of test invocation results."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_results: list[FunctionTestInvocation] = attrs.Factory(list)
|
test_results: list[FunctionTestInvocation] = attrs.Factory(list)
|
||||||
test_result_idx: dict[str, int] = attrs.Factory(dict)
|
test_result_idx: dict[str, int] = attrs.Factory(dict)
|
||||||
perf_stdout: str | None = None
|
perf_stdout: str | None = None
|
||||||
|
|
@ -324,6 +326,8 @@ class TestResults:
|
||||||
class TestFile:
|
class TestFile:
|
||||||
"""A test file ready for execution."""
|
"""A test file ready for execution."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
original_file_path: Path = attrs.field(converter=Path)
|
original_file_path: Path = attrs.field(converter=Path)
|
||||||
instrumented_behavior_file_path: Path | None = None
|
instrumented_behavior_file_path: Path | None = None
|
||||||
benchmarking_file_path: Path | None = None
|
benchmarking_file_path: Path | None = None
|
||||||
|
|
@ -335,6 +339,8 @@ class TestFile:
|
||||||
class TestFiles:
|
class TestFiles:
|
||||||
"""Collection of test files for a test run."""
|
"""Collection of test files for a test run."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
test_files: list[TestFile] = attrs.Factory(list)
|
test_files: list[TestFile] = attrs.Factory(list)
|
||||||
|
|
||||||
def get_test_type_by_instrumented_file_path(
|
def get_test_type_by_instrumented_file_path(
|
||||||
|
|
@ -372,6 +378,8 @@ class TestFiles:
|
||||||
class TestConfig:
|
class TestConfig:
|
||||||
"""Configuration for test execution."""
|
"""Configuration for test execution."""
|
||||||
|
|
||||||
|
__test__ = False
|
||||||
|
|
||||||
tests_project_rootdir: Path = attrs.field(converter=Path)
|
tests_project_rootdir: Path = attrs.field(converter=Path)
|
||||||
test_framework: str = "pytest"
|
test_framework: str = "pytest"
|
||||||
pytest_cmd: str = "pytest"
|
pytest_cmd: str = "pytest"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue