Skip to content

Commit ac7dd04

Browse files
committed
Review comments
1 parent 80728f2 commit ac7dd04

3 files changed

Lines changed: 24 additions & 2 deletions

File tree

doc/_ext/scenario_directive.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@
4343
from docutils import nodes
4444
from docutils.parsers.rst import Directive, directives
4545
from docutils.statemachine import StringList
46+
from sphinx.util import logging
4647
from sphinx.util.nodes import make_refnode
4748

49+
logger = logging.getLogger(__name__)
50+
4851
# ---------------------------------------------------------------------------
4952
# Custom node types
5053
# ---------------------------------------------------------------------------
@@ -309,6 +312,19 @@ def run(self) -> List[nodes.Node]:
309312
available = _all_scenarios(feature_abs)
310313
scenario_titles = self._requested_scenarios(available)
311314

315+
if "scenario" in self.options:
316+
available_titles = {title for _, title in available}
317+
requested = [
318+
t.strip() for t in self.options["scenario"].splitlines() if t.strip()
319+
]
320+
missing = [t for t in requested if t not in available_titles]
321+
if missing:
322+
raise self.error(
323+
f"Scenario(s) not found in {feature_file}: {', '.join(missing)}"
324+
)
325+
if not scenario_titles:
326+
raise self.error(f"No scenarios matched in {feature_file}.")
327+
312328
if self._is_pdf() and "inline" not in self.options:
313329
return self._render_pdf(feature_file, feature_abs, scenario_titles)
314330

@@ -454,6 +470,12 @@ def resolve_scenario_appendix_refs(
454470
else:
455471
para += nodes.Text(" in the Appendix.")
456472
else:
473+
logger.warning(
474+
"PDF build will omit deferred scenario examples because no "
475+
"'.. scenario-appendix::' directive was found in the document tree; "
476+
"add it to a page (e.g. an appendix) to include deferred examples.",
477+
location=ref_node,
478+
)
457479
para += nodes.Text(f"See \u201c{title}\u201d {examples} in the Appendix.")
458480

459481
ref_node.replace_self(para)

features/fetch-git-repo-with-submodule.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@update
1+
@update @report
22
Feature: Fetch projects with nested VCS dependencies
33

44
Some projects include nested version control dependencies

features/guard-against-overwriting-svn.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@update
1+
@remote-svn @update
22
Feature: Guard against overwriting in svn
33

44
Accidentally overwriting local changes could lead to introducing regressions.

0 commit comments

Comments
 (0)