@@ -80,3 +80,31 @@ It requires the parameter values to be scalars that can easily be
80
80
converted to strings. And it will fail if the same list of parameters
81
81
is passed to the same test more then once, because then, pytest will
82
82
add an index to the name to disambiguate the parameter values.
83
+
84
+ Logical combinations of dependencies
85
+ ------------------------------------
86
+
87
+ The dependencies passed as in the `depends ` argument to the
88
+ :func: `pytest.mark.dependency ` marker are combined in an and-like
89
+ manner: the current test is skipped unless *all * dependencies did
90
+ succeed. Sometimes one may want to combine the dependencies in a
91
+ different way. This is not supported by pytest-dependency out of the
92
+ box, but it is not difficult to implement. Consider the following
93
+ example:
94
+
95
+ .. literalinclude :: ../examples/or_dependency.py
96
+
97
+ The helper function `depends_or() ` is similar to
98
+ :func: `pytest_dependency.depends `, it takes the same arguments. The
99
+ only difference is that it combines the dependencies passed in the
100
+ `other ` argument in an or-like manner: the current test will be run if
101
+ *at least one * of the other tests did succeed.
102
+
103
+ The tests `test_c `, `test_d `, `test_e `, and `test_f ` in this example
104
+ all depend on two other tests. Only `test_c ` will be skipped, because
105
+ all tests in its dependency list fail. The other ones are run,
106
+ because they have at least one succeeding test in their dependency
107
+ list.
108
+
109
+ Other logical combinations of dependencies are conceivable and may be
110
+ implemented in a similar way, according to the use case at hand.
0 commit comments