From dc987c46954d6f35c44cf13d42df9e1301d0b502 Mon Sep 17 00:00:00 2001 From: pi3c Date: Sat, 12 Sep 2026 09:55:06 +0000 Subject: [PATCH] feat: initial pytest-aqatfw framework scaffold --- .gitignore | 32 +++++++++++++++++++++++++++ README.md | 21 ++++++++++++++++++ pyproject.toml | 43 +++++++++++++++++++++++++++++++++++++ src/aqatfw/__init__.py | 10 +++++++++ src/aqatfw/py.typed | 0 src/aqatfw/pytest_plugin.py | 26 ++++++++++++++++++++++ tests/test_plugin.py | 15 +++++++++++++ 7 files changed, 147 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 pyproject.toml create mode 100644 src/aqatfw/__init__.py create mode 100644 src/aqatfw/py.typed create mode 100644 src/aqatfw/pytest_plugin.py create mode 100644 tests/test_plugin.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7aeaaf6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# Python cache (ignore all) +**/__pycache__/ +*.py[cod] +*$py.class +*.pyc +*.pyo + +# IDE +.idea/ +.vscode/ +*.swp +*.swo + +# Testing +.pytest_cache/ +.coverage +htmlcov/ +.tox/ + +# mypy +.mypy_cache/ + +# ruff +.ruff_cache/ + +# Environment +.env +.venv/ +venv/ + +# uv cache +.uv/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..8a5043a --- /dev/null +++ b/README.md @@ -0,0 +1,21 @@ +# pytest-aqatfw + +Тестовый фреймворк на pytest, устанавливается через pip. + +Устанавливается как pytest-плагин (entry point `pytest11`), поэтому fixtures, +markers и helpers активируются автоматически у любого проекта с зависимостью +на этот пакет. + +```bash +pip install pytest-aqatfw +# или через uv: +uv add pytest-aqatfw +``` + +Разработка: + +```bash +uv sync --group dev +uv run pytest +uv run ruff check . && uv run mypy . +``` \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1102210 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,43 @@ +[project] +name = "pytest-aqatfw" +version = "0.1.0" +description = "Pytest-based AQA test framework, installable via pip" +readme = "README.md" +authors = [ + { name = "Sergey Vanyushkin", email = "pi3c@yandex.ru" } +] +requires-python = ">=3.13" +dependencies = [ + "pytest>=9.0.0", +] + +[project.entry-points."pytest11"] +aqatfw = "aqatfw.pytest_plugin" + +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[tool.hatch.build.targets.wheel] +packages = ["src/aqatfw"] + +[dependency-groups] +dev = [ + "ruff>=0.15.0", + "mypy>=1.20.0", +] + +[tool.pytest.ini_options] +pythonpath = ["src"] +testpaths = ["tests"] + +[tool.mypy] +strict = true + +[tool.ruff] +target-version = "py313" +line-length = 100 + +[tool.ruff.lint] +select = ["E", "F", "I", "W", "B", "C4", "SIM"] +ignore = ["E501"] \ No newline at end of file diff --git a/src/aqatfw/__init__.py b/src/aqatfw/__init__.py new file mode 100644 index 0000000..e4c8be3 --- /dev/null +++ b/src/aqatfw/__init__.py @@ -0,0 +1,10 @@ +"""pytest-aqatfw — AQA test framework built on pytest. + +The package installs as a pytest plugin (entry point ``pytest11``), +so that any test suite depending on it automatically activates the +framework's fixtures, markers, and helpers. +""" + +__version__ = "0.1.0" + +__all__ = ["__version__"] diff --git a/src/aqatfw/py.typed b/src/aqatfw/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/aqatfw/pytest_plugin.py b/src/aqatfw/pytest_plugin.py new file mode 100644 index 0000000..d9a594f --- /dev/null +++ b/src/aqatfw/pytest_plugin.py @@ -0,0 +1,26 @@ +"""pytest plugin entry point for pytest-aqatfw. + +Registers the framework with pytest. Framework features (fixtures, +markers, hooks) are added here as the project evolves. +""" + +from __future__ import annotations + +import pytest + + +def pytest_addoption(parser: pytest.Parser) -> None: + """Add pytest-aqatfw CLI options. + + Reserved for framework configuration flags. + """ + parser.addoption( + "--aqatfw", + action="store_true", + help="Enable pytest-aqatfw framework features.", + ) + + +def pytest_configure(config: pytest.Config) -> None: + """Register framework markers and verify plugin activation.""" + config.addinivalue_line("markers", "aqatfw: pytest-aqatfw framework marker") diff --git a/tests/test_plugin.py b/tests/test_plugin.py new file mode 100644 index 0000000..695654a --- /dev/null +++ b/tests/test_plugin.py @@ -0,0 +1,15 @@ +"""Smoke tests for pytest-aqatfw plugin activation.""" + +import pytest + + +def test_plugin_marker_registered(pytestconfig: pytest.Config) -> None: + """The aqatfw marker must be registered by the plugin.""" + markers = [str(m).split(":", 1)[0] for m in pytestconfig.getini("markers")] + assert "aqatfw" in markers + + +@pytest.mark.aqatfw +def test_plugin_marker_applies() -> None: + """Applying the framework marker must not break collection.""" + assert True