swarmauri_tests_griffe 0.2.1.dev2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: swarmauri_tests_griffe
3
- Version: 0.2.1.dev2
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,8 +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
- </p>
46
- ---
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>
47
47
 
48
48
  # swarmauri_tests_griffe
49
49
 
@@ -55,14 +55,14 @@ Swarmauri ecosystem.
55
55
 
56
56
  ## Features
57
57
 
58
- - **Python 3.10–3.12 coverage** – verified across the supported Swarmauri
58
+ - **Python 3.10?3.12 coverage** ? verified across the supported Swarmauri
59
59
  runtime range so you can keep consistent quality gates on every maintained
60
60
  interpreter.
61
- - **Warning-to-test enforcement** – automatically escalates Griffe warnings to
61
+ - **Warning-to-test enforcement** ? automatically escalates Griffe warnings to
62
62
  failing pytest checks to stop documentation drift before it ships.
63
- - **Zero-config discovery** – the plugin registers as a pytest entry point and
63
+ - **Zero-config discovery** ? the plugin registers as a pytest entry point and
64
64
  loads without additional setup once installed.
65
- - **Flexible targeting** – tune the inspection scope with command-line flags or
65
+ - **Flexible targeting** ? tune the inspection scope with command-line flags or
66
66
  persistent `pyproject.toml` settings.
67
67
 
68
68
  ## Installation
@@ -83,7 +83,7 @@ pip install swarmauri-tests-griffe
83
83
 
84
84
  Both commands add the plugin as a dependency of your project. Because the plugin
85
85
  uses pytest entry points, it is automatically discovered the next time your test
86
- suite runs—no manual configuration required.
86
+ suite runs?no manual configuration required.
87
87
 
88
88
  > **Supported Python versions:** The plugin is tested and published for Python
89
89
  > 3.10, 3.11, and 3.12 across the Swarmauri platform.
@@ -117,3 +117,5 @@ addopts = "--griffe-package swarmauri_core --griffe-package swarmauri_tests_grif
117
117
  With the options saved, every pytest run enforces the same quality gates across
118
118
  your codebase without extra setup.
119
119
 
120
+
121
+
@@ -11,8 +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
- </p>
15
- ---
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>
16
16
 
17
17
  # swarmauri_tests_griffe
18
18
 
@@ -24,14 +24,14 @@ Swarmauri ecosystem.
24
24
 
25
25
  ## Features
26
26
 
27
- - **Python 3.10–3.12 coverage** – verified across the supported Swarmauri
27
+ - **Python 3.10?3.12 coverage** ? verified across the supported Swarmauri
28
28
  runtime range so you can keep consistent quality gates on every maintained
29
29
  interpreter.
30
- - **Warning-to-test enforcement** – automatically escalates Griffe warnings to
30
+ - **Warning-to-test enforcement** ? automatically escalates Griffe warnings to
31
31
  failing pytest checks to stop documentation drift before it ships.
32
- - **Zero-config discovery** – the plugin registers as a pytest entry point and
32
+ - **Zero-config discovery** ? the plugin registers as a pytest entry point and
33
33
  loads without additional setup once installed.
34
- - **Flexible targeting** – tune the inspection scope with command-line flags or
34
+ - **Flexible targeting** ? tune the inspection scope with command-line flags or
35
35
  persistent `pyproject.toml` settings.
36
36
 
37
37
  ## Installation
@@ -52,7 +52,7 @@ pip install swarmauri-tests-griffe
52
52
 
53
53
  Both commands add the plugin as a dependency of your project. Because the plugin
54
54
  uses pytest entry points, it is automatically discovered the next time your test
55
- suite runs—no manual configuration required.
55
+ suite runs?no manual configuration required.
56
56
 
57
57
  > **Supported Python versions:** The plugin is tested and published for Python
58
58
  > 3.10, 3.11, and 3.12 across the Swarmauri platform.
@@ -85,3 +85,5 @@ addopts = "--griffe-package swarmauri_core --griffe-package swarmauri_tests_grif
85
85
 
86
86
  With the options saved, every pytest run enforces the same quality gates across
87
87
  your codebase without extra setup.
88
+
89
+
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "swarmauri_tests_griffe"
3
- version = "0.2.1.dev2"
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 defined in pyproject.toml."
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="Root directory for resolving packages (defaults to pytest's rootpath).",
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 = Path(root_option).resolve() if root_option else Path(config.rootpath)
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(name=package, path=Path(module_file).resolve().parent)
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(self.target.name, search_paths=[str(self.target.search_path)])
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 warnings,
162
- # treat them as relevant—Griffe ran and triggered them during inspection.
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
- f"{warning.category.__name__}: {warning.message} ({warning.filename}:{warning.lineno})"
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 self.target.path, None, f"griffe warnings for {self.target.name}"
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(config, "_swarmauri_griffe_targets", [])
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: