From 8cb6ccd234370951a8a76974740d7854dacb5807 Mon Sep 17 00:00:00 2001 From: Mayank Dhingra Date: Wed, 2 Dec 2026 12:15:49 -0500 Subject: [PATCH 1/3] Prepare opt-in dependency selection for keyword filters --- CHANGELOG.md | 4 + docs/source/configuration.rst | 30 +++ src/pytest_order/plugin.py | 18 ++ src/pytest_order/selection.py | 120 ++++++++++ tests/test_dependency_selection.py | 355 +++++++++++++++++++++++++++++ 5 files changed, 527 insertions(+) create mode 100644 src/pytest_order/selection.py create mode 100644 tests/test_dependency_selection.py diff --git a/CHANGELOG.md b/CHANGELOG.md index ea99c87..bb32112 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### New features +- added `--order-include-dependencies` to include collected prerequisites when + selecting tests with `-k` and `--order-dependencies` + ### Changes - added official support for Python 3.15 diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 541651d..4ad9e3c 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -420,6 +420,36 @@ adds ordering to the existing functionality if needed. detected at collection time and therefore are not included in ordering. The same is true for the `dynamic compilation of marked parameters`_. +.. _order-include-dependencies: + +``--order-include-dependencies`` +------------------------------- +Normally, ``-k`` selects tests independently of their dependencies. For example, +``pytest -k test_a --order-dependencies`` selects only ``test_a`` in the example +above, so ``pytest-dependency`` skips it because ``test_b`` did not run. + +Use ``--order-include-dependencies`` together with ``--order-dependencies`` to +also select its collected prerequisites:: + + $ pytest tests -vv -k test_a --order-dependencies --order-include-dependencies + ... + test_dep.py::test_b PASSED + test_dep.py::test_a PASSED + +Dependencies declared by ``dependency`` markers are followed transitively. +Their names and module, class, package or session scopes are interpreted as in +``pytest-dependency``. Parameterized dependencies can be named explicitly or +referred to by their full parameterized test name. The prerequisite does not +need to match ``-k`` itself, even if the expression explicitly excludes its name. + +This option only expands keyword selection. It does not collect tests outside +the paths given on the command line, override ``-m`` or ``--deselect``, or undo +another plugin's deselection. Dependencies added at runtime cannot be included. +Unknown dependencies and dependency cycles retain the usual ordering warnings +and ``pytest-dependency`` skip behavior. An ``order(before=...)`` or +``order(after=...)`` marker alone specifies order, not a prerequisite, and does +not select additional tests. + .. _order-marker-prefix: ``--order-marker-prefix`` diff --git a/src/pytest_order/plugin.py b/src/pytest_order/plugin.py index f420ee9..5235299 100644 --- a/src/pytest_order/plugin.py +++ b/src/pytest_order/plugin.py @@ -7,6 +7,7 @@ from _pytest.mark import Mark from pytest import Function +from .selection import DependencySelectionPlugin from .sorter import Sorter @@ -46,6 +47,14 @@ def pytest_configure(config: Config) -> None: hook_function ) config.pluginmanager.register(OrderingPlugin(), "orderingplugin") + if config.getoption("order_include_dependencies"): + if not config.getoption("order_dependencies"): + raise pytest.UsageError( + "--order-include-dependencies requires --order-dependencies" + ) + config.pluginmanager.register( + DependencySelectionPlugin(), "order_dependency_selection" + ) def pytest_addoption(parser: Parser) -> None: @@ -108,6 +117,15 @@ def pytest_addoption(parser: Parser) -> None: "If set, dependencies added by pytest-dependency will be ordered if needed." ), ) + group.addoption( + "--order-include-dependencies", + action="store_true", + dest="order_include_dependencies", + help=( + "Include collected prerequisites of tests selected by -k. " + "Requires --order-dependencies." + ), + ) group.addoption( "--order-marker-prefix", action="store", diff --git a/src/pytest_order/selection.py b/src/pytest_order/selection.py new file mode 100644 index 0000000..ff3efcf --- /dev/null +++ b/src/pytest_order/selection.py @@ -0,0 +1,120 @@ +from collections import defaultdict +from collections.abc import Generator + +import pytest +from _pytest.config import Config +from _pytest.mark import KeywordMatcher, MarkMatcher +from _pytest.mark import expression as expression_module +from _pytest.mark.expression import Expression +from _pytest.nodes import Item, Node + +PARSE_ERRORS = (SyntaxError, getattr(expression_module, "ParseError", SyntaxError)) + + +class DependencySelectionPlugin: + """Expand keyword selection without bypassing pytest's deselection hooks.""" + + @pytest.hookimpl(hookwrapper=True, tryfirst=True) + def pytest_collection_modifyitems( + self, config: Config, items: list[Item] + ) -> Generator[None]: + keyword = config.option.keyword + dependencies: set[Item] = set() + token = f"pytest_order_dependency_{id(self)}" + if keyword.lstrip(): + expression = parse_expression(keyword.lstrip(), "-k") + selected = { + item + for item in items + if expression.evaluate(KeywordMatcher.from_item(item)) + } + if config.option.markexpr: + mark_expression = parse_expression(config.option.markexpr, "-m") + selected = { + item + for item in selected + if mark_expression.evaluate(marker_matcher(item)) + } + dependencies = dependency_closure(config, items, selected) - selected + if dependencies: + # Avoid colliding with a real keyword, even one supplied by another plugin. + while any(KeywordMatcher.from_item(item)(token) for item in items): + token += "_" + for item in dependencies: + item.extra_keyword_matches.add(token) + config.option.keyword = f"({keyword}) or {token}" + try: + yield + finally: + config.option.keyword = keyword + for item in dependencies: + item.extra_keyword_matches.discard(token) + + +def parse_expression(expression: str, option: str) -> Expression: + """Use the expression parser shared by the supported pytest versions.""" + try: + return Expression.compile(expression) + except PARSE_ERRORS as error: + raise pytest.UsageError( + f"Wrong expression passed to '{option}': {expression}: {error}" + ) from None + + +def marker_matcher(item: Item): + """Support marker arguments where pytest supports them.""" + from_markers = getattr(MarkMatcher, "from_markers", None) + if from_markers is not None: + return from_markers(item.iter_markers()) + from_item = getattr(MarkMatcher, "from_item", None) + assert from_item is not None + return from_item(item) + + +def dependency_closure( + config: Config, items: list[Item], selected: set[Item] +) -> set[Item]: + """Find statically declared prerequisites using pytest-dependency's names and scopes.""" + scopes: dict[str, type[Node]] = { + "session": pytest.Session, + "package": pytest.Package, + "module": pytest.Module, + "class": pytest.Class, + } + aliases: dict[tuple[Node | None, str], list[Item]] = defaultdict(list) + try: + automark = config.getini("automark_dependency") + except ValueError: + automark = False + for item in items: + mark = item.get_closest_marker("dependency") + if mark is None and not automark: + continue + explicit_name = mark.kwargs.get("name") if mark else None + for scope, cls in scopes.items(): + node = item.getparent(cls) + if node is None: + continue + name = explicit_name or item.nodeid + if not explicit_name: + if scope == "module": + name = item.nodeid.split("::", 1)[1] + elif scope == "class": + name = item.nodeid.split("::", 2)[2] + aliases[node, name].append(item) + + included = set(selected) + pending = list(selected) + while pending: + item = pending.pop() + mark = item.get_closest_marker("dependency") + if mark is None: + continue + scope_class = scopes[mark.kwargs.get("scope", "module")] + node = item.getparent(scope_class) + for name in mark.kwargs.get("depends", []): + for dependency in aliases.get((node, name), []): + if dependency not in included: + included.add(dependency) + pending.append(dependency) + return included diff --git a/tests/test_dependency_selection.py b/tests/test_dependency_selection.py new file mode 100644 index 0000000..a59cfdc --- /dev/null +++ b/tests/test_dependency_selection.py @@ -0,0 +1,355 @@ +import pytest + +OPTIONS = ("--order-dependencies", "--order-include-dependencies") + + +def assert_outcomes(result, deselected=0, **outcomes): + # pytest 6 does not accept deselected in RunResult.assert_outcomes(). + result.assert_outcomes(**outcomes) + assert result.parseoutcomes().get("deselected", 0) == deselected + + +@pytest.fixture +def dependency_flow(test_path): + test_path.makepyfile( + test_flow=""" + import pytest + + @pytest.mark.dependency(depends=["test_setup"]) + def test_consumer(): + pass + + @pytest.mark.dependency() + def test_setup(): + pass + + def test_unrelated(): + pass + """ + ) + return test_path + + +def test_selection_is_opt_in(dependency_flow): + result = dependency_flow.runpytest("--order-dependencies", "-k", "consumer") + assert_outcomes(result, skipped=1, deselected=2) + + +@pytest.mark.parametrize("keyword", ["consumer", "consumer and not setup"]) +def test_include_dependencies(dependency_flow, keyword): + result = dependency_flow.runpytest(*OPTIONS, "-k", keyword, "-v") + assert_outcomes(result, passed=2, deselected=1) + result.stdout.fnmatch_lines(["*::test_setup PASSED*", "*::test_consumer PASSED*"]) + + +def test_requires_dependency_ordering(test_path): + result = test_path.runpytest("--order-include-dependencies") + assert result.ret == pytest.ExitCode.USAGE_ERROR + result.stderr.fnmatch_lines( + ["*--order-include-dependencies requires --order-dependencies*"] + ) + + +@pytest.mark.parametrize("keyword", [None, "does_not_exist"]) +def test_no_keyword_or_no_matches(dependency_flow, keyword): + args = ("-k", keyword) if keyword else () + result = dependency_flow.runpytest(*OPTIONS, *args) + if keyword: + assert result.ret == pytest.ExitCode.NO_TESTS_COLLECTED + assert_outcomes(result, deselected=3) + else: + assert_outcomes(result, passed=3) + + +def test_transitive_shared_dependencies(test_path): + test_path.makepyfile( + """ + import pytest + + @pytest.mark.dependency(depends=["left", "right"]) + def test_consumer(): + pass + + @pytest.mark.dependency(name="left", depends=["root"]) + def test_left(): + pass + + @pytest.mark.dependency(name="right", depends=["root"]) + def test_right(): + pass + + @pytest.mark.dependency(name="root") + def test_root(): + pass + + def test_unrelated(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer", "-v") + assert_outcomes(result, passed=4, deselected=1) + result.stdout.fnmatch_lines( + ["*::test_root PASSED*", "*::test_left PASSED*", "*::test_consumer PASSED*"] + ) + + +def test_module_names_do_not_cross_modules(test_path): + test_path.makepyfile( + test_one=""" + import pytest + + @pytest.mark.dependency(depends=["setup"]) + def test_consumer(): + pass + + @pytest.mark.dependency(name="setup") + def test_setup(): + pass + """, + test_two=""" + import pytest + + @pytest.mark.dependency(name="setup") + def test_setup(): + assert False + """, + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer", "-v") + assert_outcomes(result, passed=2, deselected=1) + result.stdout.fnmatch_lines(["test_one.py::test_setup PASSED*"]) + + +@pytest.mark.parametrize("named", [False, True]) +def test_class_scoped_dependencies(test_path, named): + name = "ready" if named else "test_setup" + mark = 'name="ready"' if named else "" + test_path.makepyfile( + f""" + import pytest + + class TestOne: + @pytest.mark.dependency(depends=["{name}"], scope="class") + def test_consumer(self): + pass + + @pytest.mark.dependency({mark}) + def test_setup(self): + pass + + class TestTwo: + @pytest.mark.dependency({mark}) + def test_setup(self): + assert False + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, passed=2, deselected=1) + + +@pytest.mark.parametrize("scope", ["session", "package"]) +@pytest.mark.parametrize("named", [False, True]) +def test_cross_module_dependencies(test_path, scope, named): + package = test_path.mkdir("package") + package.join("__init__.py").write("") + name = "ready" if named else "package/test_setup.py::test_setup" + mark = 'name="ready"' if named else "" + package.join("test_flow.py").write( + f""" +import pytest + +@pytest.mark.dependency(depends=["{name}"], scope="{scope}") +def test_consumer(): + pass +""" + ) + package.join("test_setup.py").write( + f""" +import pytest + +@pytest.mark.dependency({mark}) +def test_setup(): + pass +""" + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer", "-v") + assert_outcomes(result, passed=2) + result.stdout.fnmatch_lines( + ["*test_setup.py::test_setup PASSED*", "*test_flow.py::test_consumer PASSED*"] + ) + + +@pytest.mark.parametrize("named", [False, True]) +def test_parameter_dependencies(test_path, named): + name = "ready" if named else "test_setup[one::part]" + mark = 'name="ready"' if named else "" + test_path.makepyfile( + f""" + import pytest + + @pytest.mark.dependency(depends=["{name}"]) + def test_consumer(): + pass + + @pytest.mark.parametrize("value", [ + pytest.param(1, id="one::part", marks=pytest.mark.dependency({mark})), + pytest.param(2, id="other", marks=pytest.mark.dependency(name="other")), + ]) + def test_setup(value): + assert value == 1 + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, passed=2, deselected=1) + + +def test_automatic_dependency_marks(test_path): + test_path.makefile(".ini", pytest="[pytest]\nautomark_dependency = true") + test_path.makepyfile( + """ + import pytest + + @pytest.mark.dependency(depends=["test_setup"]) + def test_consumer(): + pass + + def test_setup(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, passed=2) + + +def test_unknown_dependencies_still_skip(test_path): + test_path.makepyfile( + """ + import pytest + + @pytest.mark.dependency(depends=["missing"]) + def test_consumer(): + pass + + def test_unrelated(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, skipped=1, deselected=1) + + +def test_cycles_do_not_loop(test_path): + test_path.makepyfile( + """ + import pytest + + @pytest.mark.dependency(depends=["test_second"]) + def test_consumer(): + pass + + @pytest.mark.dependency(depends=["test_consumer"]) + def test_second(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, skipped=2) + + +@pytest.mark.parametrize( + "extra_args", + [("-m", "selected"), ("--deselect", "test_flow.py::test_setup")], +) +def test_other_deselection_is_respected(test_path, extra_args): + test_path.makefile(".ini", pytest="[pytest]\nmarkers = selected: chosen test") + test_path.makepyfile( + test_flow=""" + import pytest + + @pytest.mark.selected + @pytest.mark.dependency(depends=["test_setup"]) + def test_consumer(): + pass + + @pytest.mark.dependency() + def test_setup(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer", *extra_args) + assert_outcomes(result, skipped=1, deselected=1) + + +def test_explicit_collection_does_not_collect_extra_tests(dependency_flow): + result = dependency_flow.runpytest( + *OPTIONS, "test_flow.py::test_consumer", "-k", "consumer" + ) + assert_outcomes(result, skipped=1) + + +def test_keyword_state_and_deselection_hooks(dependency_flow): + dependency_flow.makeconftest( + """ + def pytest_deselected(items): + assert [item.name for item in items] == ["test_unrelated"] + + def pytest_collection_finish(session): + assert session.config.option.keyword == "consumer" + for item in session.items: + assert not any(name.startswith("pytest_order_dependency_") + for name in item.extra_keyword_matches) + """ + ) + result = dependency_flow.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, passed=2, deselected=1) + + +def test_optional_dependency_plugin(dependency_flow): + dependency_flow.makefile( + ".ini", pytest="[pytest]\nmarkers = dependency: dependency information" + ) + result = dependency_flow.runpytest( + *OPTIONS, "-p", "no:dependency", "-k", "consumer" + ) + assert_outcomes(result, passed=2, deselected=1) + + +def test_real_keyword_cannot_collide_with_selection_token(dependency_flow): + dependency_flow.makeconftest( + """ + def pytest_itemcollected(item): + if item.name == "test_unrelated": + plugin = item.config.pluginmanager.getplugin("order_dependency_selection") + item.extra_keyword_matches.add(f"pytest_order_dependency_{id(plugin)}") + """ + ) + result = dependency_flow.runpytest(*OPTIONS, "-k", "consumer") + assert_outcomes(result, passed=2, deselected=1) + + +def test_deselected_consumer_does_not_select_dependencies(test_path): + test_path.makefile(".ini", pytest="[pytest]\nmarkers = chosen: selected test") + test_path.makepyfile( + test_flow=""" + import pytest + + @pytest.mark.dependency(depends=["test_setup"]) + def test_consumer(): + pass + + @pytest.mark.chosen + @pytest.mark.dependency() + def test_setup(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "consumer", "-m", "chosen") + assert result.ret == pytest.ExitCode.NO_TESTS_COLLECTED + assert_outcomes(result, deselected=2) + + +@pytest.mark.parametrize("option", ["-k", "-m"]) +def test_invalid_selection_expression(dependency_flow, option): + args = ("-k", "consumer") if option == "-m" else () + result = dependency_flow.runpytest(*OPTIONS, *args, option, "(") + assert result.ret == pytest.ExitCode.USAGE_ERROR + result.stderr.fnmatch_lines([f"*Wrong expression passed to '{option}'*"]) From f91997c4f41c3ae3f4bf833ed5de9e6502118c43 Mon Sep 17 00:00:00 2001 From: Mayank Dhingra Date: Thu, 3 Dec 2026 10:56:22 -0500 Subject: [PATCH 2/3] Define legacy keyword compatibility for dependency selection --- docs/source/configuration.rst | 6 +++ src/pytest_order/selection.py | 27 +++++++++++- tests/test_dependency_selection.py | 69 +++++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 3 deletions(-) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 4ad9e3c..3d29c6f 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -450,6 +450,12 @@ and ``pytest-dependency`` skip behavior. An ``order(before=...)`` or ``order(after=...)`` marker alone specifies order, not a prerequisite, and does not select additional tests. +On pytest 6, the deprecated ``-k '-expr'`` syntax still works. The deprecated +``-k 'expr:'`` syntax, which selects a suffix of the collection order, cannot be +combined with this option: adding an earlier prerequisite could change that +suffix and select unrelated tests. Use a standard ``-k`` expression instead. +Without this option, pytest 6's existing keyword behavior is unchanged. + .. _order-marker-prefix: ``--order-marker-prefix`` diff --git a/src/pytest_order/selection.py b/src/pytest_order/selection.py index ff3efcf..6cd39a3 100644 --- a/src/pytest_order/selection.py +++ b/src/pytest_order/selection.py @@ -1,5 +1,6 @@ from collections import defaultdict from collections.abc import Generator +from warnings import warn import pytest from _pytest.config import Config @@ -22,7 +23,8 @@ def pytest_collection_modifyitems( dependencies: set[Item] = set() token = f"pytest_order_dependency_{id(self)}" if keyword.lstrip(): - expression = parse_expression(keyword.lstrip(), "-k") + normalized_keyword, legacy_negative = normalize_keyword(keyword) + expression = parse_expression(normalized_keyword, "-k") selected = { item for item in items @@ -37,12 +39,20 @@ def pytest_collection_modifyitems( } dependencies = dependency_closure(config, items, selected) - selected if dependencies: + if legacy_negative: + # The rewritten expression no longer reaches pytest 6's legacy-syntax check. + warn( + "The `-k '-expr'` syntax to -k is deprecated.\n" + "Use `-k 'not expr'` instead.", + pytest.PytestDeprecationWarning, + stacklevel=2, + ) # Avoid colliding with a real keyword, even one supplied by another plugin. while any(KeywordMatcher.from_item(item)(token) for item in items): token += "_" for item in dependencies: item.extra_keyword_matches.add(token) - config.option.keyword = f"({keyword}) or {token}" + config.option.keyword = f"({normalized_keyword}) or {token}" try: yield finally: @@ -51,6 +61,19 @@ def pytest_collection_modifyitems( item.extra_keyword_matches.discard(token) +def normalize_keyword(keyword: str) -> tuple[str, bool]: + """Preserve pytest 6's negative syntax; suffix selection cannot be safely expanded.""" + keyword = keyword.lstrip() + legacy = pytest.__version__.split(".", 1)[0] == "6" + if legacy and keyword.endswith(":"): + raise pytest.UsageError( + "--order-include-dependencies does not support pytest 6's deprecated " + "'-k expr:' suffix selection; use a standard -k expression" + ) + negative = legacy and keyword.startswith("-") + return (f"not {keyword[1:]}" if negative else keyword), negative + + def parse_expression(expression: str, option: str) -> Expression: """Use the expression parser shared by the supported pytest versions.""" try: diff --git a/tests/test_dependency_selection.py b/tests/test_dependency_selection.py index a59cfdc..21e310b 100644 --- a/tests/test_dependency_selection.py +++ b/tests/test_dependency_selection.py @@ -35,7 +35,9 @@ def test_selection_is_opt_in(dependency_flow): assert_outcomes(result, skipped=1, deselected=2) -@pytest.mark.parametrize("keyword", ["consumer", "consumer and not setup"]) +@pytest.mark.parametrize( + "keyword", ["consumer", "consumer and not setup", "\nconsumer"] +) def test_include_dependencies(dependency_flow, keyword): result = dependency_flow.runpytest(*OPTIONS, "-k", keyword, "-v") assert_outcomes(result, passed=2, deselected=1) @@ -353,3 +355,68 @@ def test_invalid_selection_expression(dependency_flow, option): result = dependency_flow.runpytest(*OPTIONS, *args, option, "(") assert result.ret == pytest.ExitCode.USAGE_ERROR result.stderr.fnmatch_lines([f"*Wrong expression passed to '{option}'*"]) + + +@pytest.mark.skipif( + pytest.__version__.split(".", 1)[0] != "6", + reason="Legacy syntax exists only in pytest 6", +) +def test_legacy_negative_keyword(test_path): + test_path.makepyfile( + test_flow=""" + import pytest + + @pytest.mark.dependency(depends=["test_excluded_setup"]) + def test_consumer(): + pass + + @pytest.mark.dependency() + def test_excluded_setup(): + pass + + def test_excluded_unrelated(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k=-excluded") + assert_outcomes(result, passed=2, deselected=1) + result.stdout.fnmatch_lines(["*Use `-k 'not expr'` instead.*"]) + + +@pytest.mark.skipif( + pytest.__version__.split(".", 1)[0] != "6", + reason="Legacy syntax exists only in pytest 6", +) +def test_legacy_suffix_requires_standard_expression(dependency_flow): + result = dependency_flow.runpytest(*OPTIONS, "-k", "consumer:") + assert result.ret == pytest.ExitCode.USAGE_ERROR + result.stderr.fnmatch_lines( + ["*deprecated*'-k expr:'*use a standard -k expression*"] + ) + + # Without the opt-in flag, pytest's original suffix-selection behavior is preserved. + result = dependency_flow.runpytest("--order-dependencies", "-k", "consumer:") + assert_outcomes(result, passed=3) + + +@pytest.mark.skipif( + pytest.__version__.split(".", 1)[0] == "6", + reason="A trailing colon is legacy syntax in pytest 6", +) +def test_modern_colon_keyword(test_path): + test_path.makepyfile( + test_flow=""" + import pytest + + @pytest.mark.parametrize("value", [pytest.param(1, id="tail:")]) + @pytest.mark.dependency(depends=["test_setup"]) + def test_consumer(value): + pass + + @pytest.mark.dependency() + def test_setup(): + pass + """ + ) + result = test_path.runpytest(*OPTIONS, "-k", "tail:") + assert_outcomes(result, passed=2) From c50be01f154c8a675392ae6a1627883f687a9371 Mon Sep 17 00:00:00 2001 From: Mayank Dhingra Date: Thu, 3 Dec 2026 11:42:32 -0500 Subject: [PATCH 3/3] Fix dependency selection heading underline --- docs/source/configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/configuration.rst b/docs/source/configuration.rst index 3d29c6f..cca1f89 100644 --- a/docs/source/configuration.rst +++ b/docs/source/configuration.rst @@ -423,7 +423,7 @@ adds ordering to the existing functionality if needed. .. _order-include-dependencies: ``--order-include-dependencies`` -------------------------------- +-------------------------------- Normally, ``-k`` selects tests independently of their dependencies. For example, ``pytest -k test_a --order-dependencies`` selects only ``test_a`` in the example above, so ``pytest-dependency`` skips it because ``test_b`` did not run.