swarmauri_tests_griffe 0.2.1.dev3__tar.gz → 0.11.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {swarmauri_tests_griffe-0.2.1.dev3 → swarmauri_tests_griffe-0.11.0.dev1}/PKG-INFO +10 -7
- {swarmauri_tests_griffe-0.2.1.dev3 → swarmauri_tests_griffe-0.11.0.dev1}/README.md +9 -6
- {swarmauri_tests_griffe-0.2.1.dev3 → swarmauri_tests_griffe-0.11.0.dev1}/pyproject.toml +1 -1
- {swarmauri_tests_griffe-0.2.1.dev3 → swarmauri_tests_griffe-0.11.0.dev1}/swarmauri_tests_griffe/__init__.py +35 -16
- {swarmauri_tests_griffe-0.2.1.dev3 → swarmauri_tests_griffe-0.11.0.dev1}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: swarmauri_tests_griffe
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.11.0.dev1
|
|
4
4
|
Summary: Pytest plugin that turns Griffe inspection warnings into failing quality gates for Swarmauri packages.
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -42,7 +42,8 @@ Description-Content-Type: text/markdown
|
|
|
42
42
|
<img src="https://img.shields.io/pypi/l/swarmauri_tests_griffe" alt="PyPI - License"/></a>
|
|
43
43
|
<a href="https://pypi.org/project/swarmauri_tests_griffe/">
|
|
44
44
|
<img src="https://img.shields.io/pypi/v/swarmauri_tests_griffe?label=swarmauri_tests_griffe&color=green" alt="PyPI - swarmauri_tests_griffe"/></a>
|
|
45
|
-
|
|
45
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
46
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
46
47
|
|
|
47
48
|
# swarmauri_tests_griffe
|
|
48
49
|
|
|
@@ -54,14 +55,14 @@ Swarmauri ecosystem.
|
|
|
54
55
|
|
|
55
56
|
## Features
|
|
56
57
|
|
|
57
|
-
- **Python 3.10
|
|
58
|
+
- **Python 3.10?3.12 coverage** ? verified across the supported Swarmauri
|
|
58
59
|
runtime range so you can keep consistent quality gates on every maintained
|
|
59
60
|
interpreter.
|
|
60
|
-
- **Warning-to-test enforcement**
|
|
61
|
+
- **Warning-to-test enforcement** ? automatically escalates Griffe warnings to
|
|
61
62
|
failing pytest checks to stop documentation drift before it ships.
|
|
62
|
-
- **Zero-config discovery**
|
|
63
|
+
- **Zero-config discovery** ? the plugin registers as a pytest entry point and
|
|
63
64
|
loads without additional setup once installed.
|
|
64
|
-
- **Flexible targeting**
|
|
65
|
+
- **Flexible targeting** ? tune the inspection scope with command-line flags or
|
|
65
66
|
persistent `pyproject.toml` settings.
|
|
66
67
|
|
|
67
68
|
## Installation
|
|
@@ -82,7 +83,7 @@ pip install swarmauri-tests-griffe
|
|
|
82
83
|
|
|
83
84
|
Both commands add the plugin as a dependency of your project. Because the plugin
|
|
84
85
|
uses pytest entry points, it is automatically discovered the next time your test
|
|
85
|
-
suite runs
|
|
86
|
+
suite runs?no manual configuration required.
|
|
86
87
|
|
|
87
88
|
> **Supported Python versions:** The plugin is tested and published for Python
|
|
88
89
|
> 3.10, 3.11, and 3.12 across the Swarmauri platform.
|
|
@@ -116,3 +117,5 @@ addopts = "--griffe-package swarmauri_core --griffe-package swarmauri_tests_grif
|
|
|
116
117
|
With the options saved, every pytest run enforces the same quality gates across
|
|
117
118
|
your codebase without extra setup.
|
|
118
119
|
|
|
120
|
+
|
|
121
|
+
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
<img src="https://img.shields.io/pypi/l/swarmauri_tests_griffe" alt="PyPI - License"/></a>
|
|
12
12
|
<a href="https://pypi.org/project/swarmauri_tests_griffe/">
|
|
13
13
|
<img src="https://img.shields.io/pypi/v/swarmauri_tests_griffe?label=swarmauri_tests_griffe&color=green" alt="PyPI - swarmauri_tests_griffe"/></a>
|
|
14
|
-
|
|
14
|
+
<a href="https://discord.gg/N4UpBuQv8T">
|
|
15
|
+
<img src="https://img.shields.io/badge/Discord-Join%20Chat-5865F2?logo=discord&logoColor=white" alt="Discord"/></a></p>
|
|
15
16
|
|
|
16
17
|
# swarmauri_tests_griffe
|
|
17
18
|
|
|
@@ -23,14 +24,14 @@ Swarmauri ecosystem.
|
|
|
23
24
|
|
|
24
25
|
## Features
|
|
25
26
|
|
|
26
|
-
- **Python 3.10
|
|
27
|
+
- **Python 3.10?3.12 coverage** ? verified across the supported Swarmauri
|
|
27
28
|
runtime range so you can keep consistent quality gates on every maintained
|
|
28
29
|
interpreter.
|
|
29
|
-
- **Warning-to-test enforcement**
|
|
30
|
+
- **Warning-to-test enforcement** ? automatically escalates Griffe warnings to
|
|
30
31
|
failing pytest checks to stop documentation drift before it ships.
|
|
31
|
-
- **Zero-config discovery**
|
|
32
|
+
- **Zero-config discovery** ? the plugin registers as a pytest entry point and
|
|
32
33
|
loads without additional setup once installed.
|
|
33
|
-
- **Flexible targeting**
|
|
34
|
+
- **Flexible targeting** ? tune the inspection scope with command-line flags or
|
|
34
35
|
persistent `pyproject.toml` settings.
|
|
35
36
|
|
|
36
37
|
## Installation
|
|
@@ -51,7 +52,7 @@ pip install swarmauri-tests-griffe
|
|
|
51
52
|
|
|
52
53
|
Both commands add the plugin as a dependency of your project. Because the plugin
|
|
53
54
|
uses pytest entry points, it is automatically discovered the next time your test
|
|
54
|
-
suite runs
|
|
55
|
+
suite runs?no manual configuration required.
|
|
55
56
|
|
|
56
57
|
> **Supported Python versions:** The plugin is tested and published for Python
|
|
57
58
|
> 3.10, 3.11, and 3.12 across the Swarmauri platform.
|
|
@@ -84,3 +85,5 @@ addopts = "--griffe-package swarmauri_core --griffe-package swarmauri_tests_grif
|
|
|
84
85
|
|
|
85
86
|
With the options saved, every pytest run enforces the same quality gates across
|
|
86
87
|
your codebase without extra setup.
|
|
88
|
+
|
|
89
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "swarmauri_tests_griffe"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.11.0.dev1"
|
|
4
4
|
description = "Pytest plugin that turns Griffe inspection warnings into failing quality gates for Swarmauri packages."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10,<3.15"
|
|
@@ -42,7 +42,8 @@ def pytest_addoption(parser: pytest.Parser) -> None:
|
|
|
42
42
|
default=None,
|
|
43
43
|
help=(
|
|
44
44
|
"Package name to inspect with Griffe. "
|
|
45
|
-
"Can be provided multiple times. Defaults to the package
|
|
45
|
+
"Can be provided multiple times. Defaults to the package "
|
|
46
|
+
"defined in pyproject.toml."
|
|
46
47
|
),
|
|
47
48
|
)
|
|
48
49
|
group.addoption(
|
|
@@ -50,7 +51,10 @@ def pytest_addoption(parser: pytest.Parser) -> None:
|
|
|
50
51
|
action="store",
|
|
51
52
|
dest="griffe_root",
|
|
52
53
|
default=None,
|
|
53
|
-
help=
|
|
54
|
+
help=(
|
|
55
|
+
"Root directory for resolving packages (defaults to pytest's "
|
|
56
|
+
"rootpath)."
|
|
57
|
+
),
|
|
54
58
|
)
|
|
55
59
|
|
|
56
60
|
|
|
@@ -82,7 +86,9 @@ def _discover_from_pyproject(root: Path) -> list[str]:
|
|
|
82
86
|
|
|
83
87
|
def _discover_packages(config: pytest.Config) -> list[GriffeTarget]:
|
|
84
88
|
root_option = config.getoption("griffe_root")
|
|
85
|
-
root =
|
|
89
|
+
root = (
|
|
90
|
+
Path(root_option).resolve() if root_option else Path(config.rootpath)
|
|
91
|
+
)
|
|
86
92
|
packages = config.getoption("griffe_packages")
|
|
87
93
|
explicit = bool(packages)
|
|
88
94
|
package_names: list[str]
|
|
@@ -113,23 +119,23 @@ def _discover_packages(config: pytest.Config) -> list[GriffeTarget]:
|
|
|
113
119
|
# Fall back to importing the module to resolve its path.
|
|
114
120
|
try:
|
|
115
121
|
module = importlib.import_module(package)
|
|
116
|
-
except
|
|
117
|
-
Exception
|
|
118
|
-
): # pragma: no cover - import failure should surface during test discovery
|
|
122
|
+
except Exception: # pragma: no cover - import failure should surface during test discovery # noqa: E501
|
|
119
123
|
if explicit:
|
|
120
124
|
raise pytest.UsageError(
|
|
121
|
-
f"Unable to resolve package '{package}' for Griffe inspection."
|
|
125
|
+
f"Unable to resolve package '{package}' for Griffe inspection." # noqa: E501
|
|
122
126
|
) from None
|
|
123
127
|
continue
|
|
124
128
|
module_file = getattr(module, "__file__", None)
|
|
125
129
|
if not module_file:
|
|
126
130
|
if explicit:
|
|
127
131
|
raise pytest.UsageError(
|
|
128
|
-
f"Unable to resolve package '{package}' for Griffe inspection."
|
|
132
|
+
f"Unable to resolve package '{package}' for Griffe inspection." # noqa: E501
|
|
129
133
|
)
|
|
130
134
|
continue
|
|
131
135
|
targets.append(
|
|
132
|
-
GriffeTarget(
|
|
136
|
+
GriffeTarget(
|
|
137
|
+
name=package, path=Path(module_file).resolve().parent
|
|
138
|
+
)
|
|
133
139
|
)
|
|
134
140
|
seen.add(package)
|
|
135
141
|
return targets
|
|
@@ -151,27 +157,38 @@ class GriffeWarningsItem(pytest.Item):
|
|
|
151
157
|
def runtest(self) -> None:
|
|
152
158
|
with warnings.catch_warnings(record=True) as caught:
|
|
153
159
|
warnings.simplefilter("always")
|
|
154
|
-
griffe.load(
|
|
160
|
+
griffe.load(
|
|
161
|
+
self.target.name, search_paths=[str(self.target.search_path)]
|
|
162
|
+
)
|
|
155
163
|
griffe_warnings = [
|
|
156
164
|
warning
|
|
157
165
|
for warning in caught
|
|
158
166
|
if "griffe" in (warning.filename or "")
|
|
159
167
|
or warning.category.__module__.startswith("griffe")
|
|
160
168
|
]
|
|
161
|
-
# If we didn't detect explicit Griffe warnings but still captured
|
|
162
|
-
#
|
|
169
|
+
# If we didn't detect explicit Griffe warnings but still captured
|
|
170
|
+
# warnings,
|
|
171
|
+
# treat them as relevant—Griffe ran and triggered them during
|
|
172
|
+
# inspection.
|
|
163
173
|
relevant = griffe_warnings or caught
|
|
164
174
|
if relevant:
|
|
165
175
|
formatted = "\n".join(
|
|
166
|
-
|
|
176
|
+
(
|
|
177
|
+
f"{warning.category.__name__}: {warning.message} "
|
|
178
|
+
f"({warning.filename}:{warning.lineno})"
|
|
179
|
+
)
|
|
167
180
|
for warning in relevant
|
|
168
181
|
)
|
|
169
182
|
raise AssertionError(
|
|
170
|
-
f"Griffe emitted warnings while loading {self.target.name}:\n{formatted}"
|
|
183
|
+
f"Griffe emitted warnings while loading {self.target.name}:\n{formatted}" # noqa: E501
|
|
171
184
|
)
|
|
172
185
|
|
|
173
186
|
def reportinfo(self) -> tuple[Path, int | None, str]:
|
|
174
|
-
return
|
|
187
|
+
return (
|
|
188
|
+
self.target.path,
|
|
189
|
+
None,
|
|
190
|
+
f"griffe warnings for {self.target.name}",
|
|
191
|
+
)
|
|
175
192
|
|
|
176
193
|
|
|
177
194
|
def pytest_configure(config: pytest.Config) -> None:
|
|
@@ -183,7 +200,9 @@ def pytest_configure(config: pytest.Config) -> None:
|
|
|
183
200
|
def pytest_collection_modifyitems(
|
|
184
201
|
session: pytest.Session, config: pytest.Config, items: list[pytest.Item]
|
|
185
202
|
) -> None:
|
|
186
|
-
targets: list[GriffeTarget] = getattr(
|
|
203
|
+
targets: list[GriffeTarget] = getattr(
|
|
204
|
+
config, "_swarmauri_griffe_targets", []
|
|
205
|
+
)
|
|
187
206
|
if not targets:
|
|
188
207
|
return
|
|
189
208
|
for target in targets:
|
|
File without changes
|