mit einem Klick
wpt-gen-testing
// Guidelines for Python testing using pytest, including coverage constraints, mock migrations, type safety (mypy), and style linting (ruff) in WPT-Gen.
// Guidelines for Python testing using pytest, including coverage constraints, mock migrations, type safety (mypy), and style linting (ruff) in WPT-Gen.
Instructions to manually test the generate workflow of WPT-Gen to verify system integrity.
Generate Web Platform Tests (WPT) from minimal XML test suggestions. The agent will autonomously determine the test type and implementation details by analyzing existing repository paradigms. Use when the user asks to generate a Web Platform Test based on a test suggestion.
Best practices for CLI infrastructure, outputs, subprocess management, and templating in WPT-Gen.
Best practices for configuring LLM integrations, concurrent networking, context scraping, and managing prompts in WPT-Gen.
Instructions on managing dependencies, build tools, project architecture rules, and integrating workflows via the Makefile in WPT-Gen.
Guidelines for finalizing changes, running presubmit checks, and preparing for submission in WPT-Gen.
| name | wpt-gen-testing |
| description | Guidelines for Python testing using pytest, including coverage constraints, mock migrations, type safety (mypy), and style linting (ruff) in WPT-Gen. |
This document outlines the testing and static analysis practices used in the wpt-gen repository. Our goal is 100% type safety and high test coverage.
WPT-Gen relies on pytest for its testing framework.
tests/ directory.pytest.mark.asyncio decorator (provided by pytest-asyncio) for any async def test_...() functions.pytest.mark.parametrize to rigorously cover provider matrices (Gemini, OpenAI, Anthropic tests) cleanly within isolated scopes.assert statements. Avoid unittest.TestCase inheritance unless absolutely necessary for a legacy mock.mocker fixture (provided by pytest-mock) to isolate units under test. Completely reject and avoid legacy unittest.mock approaches (like @patch or patch.object) inside native pytest scopes.except Exception: blocks unless strictly re-raising. Actively catch explicit exceptions (OSError, HTTPError) to prove the error handlers function correctly. Reviewers must flag lazily wrapped except Exception: catch-alls.WPT-Gen actively pipelines against --cov-fail-under thresholds to monitor test stability.
# pragma: no cover for artificially bypassing untested error handlers or logical edge-cases in pursuit of arbitrary 100% metrics.# pragma: no cover in a PR, instruct the developer to either write the corresponding test matrix, or lower the overall --cov-fail-under requirement (e.g., dial it back to 95%). Artificial masking creates a severe false sense of security over time.WPT-Gen enforces strict type checking using mypy.
pyproject.toml with strict = true.Any: Avoid using Any wherever possible. If integrating with untyped third-party libraries, use # type: ignore sparingly and document why it is necessary.WPT-Gen uses Ruff as a unified linter and formatter.
pyproject.toml enables a wide range of rules (e.g., E, W, F, B, UP, PT). Pay special attention to the PT (pytest-style) rules when writing tests.black and isort. Run make lint-fix (or make format) to automatically fix style issues, including sorting imports and enforcing single quotes (quote-style = "single").