Answer architecture round 1: 0 🔴, 6 🟡 (0 misread); one definition of a test file, task-bench's tree classification in tree_tests.py, the push poll in forge, preflight's folder named once, the Re-entry rows named; the rank_todo warning kept, as its item asked for it
This commit is contained in:
@@ -9,7 +9,14 @@ HUNK = re.compile(r"^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@", re.MULTILINE)
|
||||
STRYKER = (".cjs", ".cts", ".js", ".jsx", ".mjs", ".mts", ".ts", ".tsx")
|
||||
TOOLS = {".go": "gremlins", ".php": "infection", ".py": "mutmut", ".rs": "cargo-mutants", **dict.fromkeys(STRYKER, "stryker")}
|
||||
TEST_FOLDERS = frozenset({"__tests__", "test", "tests"})
|
||||
TEST_NAME = re.compile(r"test_.*\.py|.*_test\.py|conftest\.py|.*_test\.go|.*\.(?:spec|test)\.[^.]+")
|
||||
# The suffixes `node --test` runs: JavaScript, and TypeScript where Node strips the types; not `.jsx` or `.tsx`, which it doesn't find.
|
||||
NODE_SUFFIXES = (".cjs", ".cts", ".js", ".mjs", ".mts", ".ts")
|
||||
# pytest's and Go's names and `*.spec.*` and `*.test.*`; PHPUnit's default suffix; node --test's `*-test`, `*_test`, `test-*` and `test`
|
||||
# stems, in each of its suffixes.
|
||||
TEST_NAME = re.compile(
|
||||
r"test_.*\.py|.*_test\.py|conftest\.py|.*_test\.go|.*\.(?:spec|test)\.[^.]+"
|
||||
rf"|.*Test\.php|(?:.*[-_]test|test|test-.*)(?:{'|'.join(re.escape(suffix) for suffix in NODE_SUFFIXES)})"
|
||||
)
|
||||
|
||||
|
||||
def added_lines(diff: str) -> frozenset[int]:
|
||||
@@ -34,6 +41,7 @@ def tool_for(path: str) -> str | None:
|
||||
|
||||
|
||||
def is_test(path: str) -> bool:
|
||||
"""Whether path is a test by its name or folder alone, as pytest, Go, PHPUnit, `node --test` or a `tests` folder tells it."""
|
||||
folders, name = posixpath.split(path)
|
||||
return bool(TEST_FOLDERS & set(folders.split("/")) or TEST_NAME.fullmatch(name))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user