Source code for curate_ipsum.models
from __future__ import annotations
from datetime import datetime
from enum import StrEnum
from typing import Literal, Union
from pydantic import BaseModel
[docs]
class RunKind(StrEnum):
UNIT = "unit"
INTEGRATION = "integration"
MUTATION = "mutation"
[docs]
class TestRunResult(RunMeta):
kind: Literal[RunKind.UNIT, RunKind.INTEGRATION]
passed: bool
totalTests: int
passedTests: int
failedTests: int
durationMs: int
framework: str
failingTests: list[str]
[docs]
class FileMutationStats(BaseModel):
filePath: str
totalMutants: int
killed: int
survived: int
noCoverage: int
mutationScore: float
[docs]
class MutationRunResult(RunMeta):
kind: Literal[RunKind.MUTATION]
tool: str
totalMutants: int
killed: int
survived: int
noCoverage: int
mutationScore: float
runtimeMs: int
byFile: list[FileMutationStats]
[docs]
class PIDComponents(BaseModel):
p: float
i: float
d: float
[docs]
class RegionMetrics(BaseModel):
projectId: str
commitSha: str
regionId: str
mutationScore: float
centrality: float
triviality: float
pid: PIDComponents
RunResult = Union[TestRunResult, MutationRunResult]
[docs]
class RunHistory(BaseModel):
projectId: str
regionId: str | None = None
runs: list[RunResult]