Skip to content

Commit 4efb66e

Browse files
committed
fix(plugins): Collect-only parameter
1 parent 5bb5071 commit 4efb66e

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

docs/scripts/gen_test_case_reference.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"pytest_plugins.filler.gen_test_doc.gen_test_doc",
4646
"-p",
4747
"pytest_plugins.filler.eip_checklist",
48-
"--collect-only",
4948
"--gen-docs",
5049
f"--gen-docs-target-fork={TARGET_FORK}",
5150
f"--until={GENERATE_UNTIL_FORK}",

src/cli/pytest_commands/checklist.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ def process_arguments(self, pytest_args: List[str]) -> List[str]:
2121
processed_args = super().process_arguments(pytest_args)
2222

2323
# Add collect-only flag to avoid running tests
24-
if "--collect-only" not in processed_args:
25-
processed_args.append("--collect-only")
26-
2724
processed_args.extend(["-p", "pytest_plugins.filler.eip_checklist"])
2825

2926
return processed_args
@@ -66,8 +63,7 @@ def checklist(output: str, eip: tuple, **kwargs) -> None:
6663
6764
"""
6865
# Add output directory to pytest args
69-
args = ["-p", "pytest_plugins.filler.eip_checklist"]
70-
args.extend(["--checklist-output", output])
66+
args = ["--checklist-output", output]
7167

7268
# Add EIP filter if specified
7369
for eip_num in eip:

src/pytest_plugins/filler/eip_checklist.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,19 @@ def generate_filled_checklist(self, eip: int, output_dir: Path) -> Path:
227227

228228
return output_dir
229229

230+
@pytest.hookimpl(tryfirst=True)
231+
def pytest_runtestloop(self, session):
232+
"""Skip test execution, only generate checklists."""
233+
session.testscollected = 0
234+
return True
235+
230236
def pytest_collection_modifyitems(self, config: pytest.Config, items: List[pytest.Item]):
231237
"""Collect checklist markers during test collection."""
232238
for item in items:
233239
eip, eip_path = self.extract_eip_from_path(Path(item.location[0]))
234240
if eip_path is not None and eip is not None:
235241
self.eip_paths[eip] = eip_path
236-
if item.get_closest_marker("derived_test"):
242+
if item.get_closest_marker("derived_test") or item.get_closest_marker("skip"):
237243
continue
238244
self.collect_from_item(item, eip)
239245

@@ -247,6 +253,9 @@ def pytest_collection_modifyitems(self, config: pytest.Config, items: List[pytes
247253

248254
checklist_props = {}
249255

256+
if not self.eip_checklist_items:
257+
pytest.exit("\nNo EIPs found with checklist markers.", returncode=pytest.ExitCode.OK)
258+
250259
# Generate a checklist for each EIP
251260
for eip in sorted(self.eip_checklist_items.keys()):
252261
# Skip if specific EIPs were requested and this isn't one of them
@@ -267,7 +276,7 @@ def pytest_collection_modifyitems(self, config: pytest.Config, items: List[pytes
267276
)
268277
else:
269278
checklist_path = self.generate_filled_checklist(eip, checklist_output)
270-
print(f"Generated EIP-{eip} checklist: {checklist_path}")
279+
print(f"\nGenerated EIP-{eip} checklist: {checklist_path}")
271280

272281
if checklist_doc_gen:
273282
config.checklist_props = checklist_props # type: ignore

src/pytest_plugins/shared/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def is_help_or_collectonly_mode(config: pytest.Config) -> bool:
1919
or config.getoption("show_ported_from")
2020
or config.getoption("links_as_filled")
2121
or config.getoption("help")
22+
or config.pluginmanager.has_plugin("pytest_plugins.filler.eip_checklist")
23+
or config.pluginmanager.has_plugin("pytest_plugins.filler.gen_test_doc.gen_test_doc")
2224
)
2325

2426

0 commit comments

Comments
 (0)