Skip to content

Commit b32e6eb

Browse files
committed
Make more user facing
1 parent ba0b733 commit b32e6eb

4 files changed

Lines changed: 38 additions & 23 deletions

File tree

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ behave features/
2323
# Single feature file
2424
behave features/git-fetch.feature
2525

26+
# Feature tests for a specific command (e.g. update, check, diff, report)
27+
behave features/ --tags=update
28+
2629
# Full test run with coverage (as CI does it)
2730
pytest --cov=dfetch tests/
2831
coverage run --source=dfetch --append -m behave features
@@ -87,6 +90,7 @@ Implement the abstract interfaces in `dfetch/project/subproject.py` and `dfetch/
8790

8891
- **Unit tests** live in `tests/` and use `pytest`. Test files mirror module names (e.g., `tests/test_manifest.py`).
8992
- **BDD feature tests** live in `features/` and use `behave`. Step definitions are in `features/steps/`. Feature files describe end-to-end workflows.
93+
- Feature files are tagged with the command they exercise (e.g. `@update`, `@check`). If your change affects a command, run its feature tests using the command tag: `behave features/ --tags=<command>`.
9094
- Docstrings in test functions follow Google style as a convention (CI runs `pydocstyle dfetch` and does not check `tests/`, so this is not enforced automatically).
9195

9296
## Code quality rules

doc/_ext/scenario_directive.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Custom Sphinx directive for including Gherkin scenarios from feature files.
2+
Custom Sphinx directive for including feature examples from feature files.
33
44
Usage in conf.py:
55
@@ -14,12 +14,12 @@
1414
1515
.. scenario-include:: ../features/fetch-git-repo.feature
1616
:scenario:
17-
Scenario Title 1
18-
Scenario Title 2
17+
Example Title 1
18+
Example Title 2
1919
20-
If ``:scenario:`` is omitted, all scenarios in the feature file are included.
20+
If ``:scenario:`` is omitted, all examples in the feature file are included.
2121
22-
**PDF / LaTeX builds** automatically move scenarios to an appendix grouped by
22+
**PDF / LaTeX builds** automatically move examples to an appendix grouped by
2323
the first non-excluded behave tag found on the feature file. The directive's
2424
original location receives a cross-reference to the appendix entry instead.
2525
@@ -144,9 +144,9 @@ def _tag_section_title(tag: str) -> str:
144144

145145

146146
class ScenarioIncludeDirective(Directive):
147-
"""Include Gherkin scenarios from a feature file.
147+
"""Include feature examples from a feature file.
148148
149-
In PDF/LaTeX builds the scenarios are moved to a dedicated appendix and
149+
In PDF/LaTeX builds the examples are moved to a dedicated appendix and
150150
replaced inline by a cross-reference, unless ``:inline:`` is given.
151151
"""
152152

@@ -295,9 +295,9 @@ def _render_pdf(
295295
ref_node["label"] = label
296296
ref_node["reftitle"] = title
297297
para = nodes.paragraph()
298-
para += nodes.emphasis(text="Scenarios: see ")
298+
para += nodes.Text("See the example \u201c")
299299
para += ref_node
300-
para += nodes.emphasis(text=" in the appendix.")
300+
para += nodes.Text("\u201d in the Appendix.")
301301
return [para]
302302

303303
# ------------------------------------------------------------------
@@ -327,14 +327,14 @@ def run(self) -> List[nodes.Node]:
327327

328328

329329
class ScenarioAppendixDirective(Directive):
330-
"""Render the appendix of all PDF-deferred scenarios.
330+
"""Render the appendix of all PDF-deferred feature examples.
331331
332332
Place this directive once in the document (typically in an appendix
333333
page). During the write phase it is replaced by sections grouped by
334334
the first non-excluded tag, sorted alphabetically, containing the full
335335
content of each referenced feature file.
336336
337-
In HTML builds scenarios appear inline in the main text, so this
337+
In HTML builds examples appear inline in the main text, so this
338338
directive emits an explanatory note instead.
339339
"""
340340

@@ -348,9 +348,9 @@ def run(self) -> List[nodes.Node]:
348348
note = nodes.note()
349349
para = nodes.paragraph()
350350
para += nodes.Text(
351-
"In the HTML edition, feature scenarios appear as expandable "
352-
"examples directly within each guide section. "
353-
"In the PDF edition they are collected here, grouped by tag."
351+
"In the HTML edition, feature examples appear as expandable "
352+
"blocks directly within each guide section. "
353+
"In the PDF edition they are collected here, grouped by command."
354354
)
355355
note += para
356356
return [note]

doc/appendix/scenarios.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
.. _scenario-appendix:
22

3-
Appendix: Feature scenarios
3+
Appendix: Feature Examples
44
============================
55

6-
This appendix collects all the Gherkin feature scenarios that illustrate
7-
dfetch's behaviour. In the HTML documentation each scenario appears inline,
8-
folded inside an expandable *Example* block. In the PDF edition the scenarios
9-
are moved here, grouped alphabetically by tag.
6+
This appendix collects all the feature test examples that demonstrate dfetch's
7+
behaviour. Each example is an actual test that runs as part of dfetch's test
8+
suite, showing exactly how dfetch behaves in a given situation.
9+
10+
In the HTML documentation each example appears inline, folded inside an
11+
expandable block directly within the relevant guide section. In the PDF
12+
edition they are collected here, grouped by command.
1013

1114
.. scenario-appendix::

doc/howto/contributing.rst

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,19 +83,27 @@ Feature tests
8383
~~~~~~~~~~~~~
8484
Feature tests are used for higher-level integration testing of functionality.
8585
For this `behave <https://behave.readthedocs.io/en/latest/>`_ is used as testing framework.
86-
Features are specified in *Gherkin* in so-called feature files in the ``features`` folder.
87-
The sentences in the feature files, map to steps in the ``features/steps`` folder.
86+
Feature files in the ``features`` folder contain plain-language examples that
87+
demonstrate dfetch's behaviour. The sentences in the feature files map to step
88+
definitions in the ``features/steps`` folder.
8889

89-
Test can be run directly from the command-line
90+
Tests can be run directly from the command-line:
9091

9192
.. code-block:: bash
9293
9394
behave features
9495
96+
Feature files are tagged with the command they exercise (e.g. ``@update``,
97+
``@check``). You can run just the examples for a specific command using its tag:
98+
99+
.. code-block:: bash
100+
101+
behave features --tags=update
102+
95103
Alternatively in VSCode run the ``Run all feature tests`` task from the command palette.
96104

97105
To debug these tests, mark the ``Feature:`` or ``Scenario:`` to debug with the ``@wip`` tag
98-
and add run the ``Feature tests (wip)`` debug configuration in VSCode.
106+
and run the ``Feature tests (wip)`` debug configuration in VSCode.
99107

100108

101109
Creating documentation

0 commit comments

Comments
 (0)