1
1
Reference
2
2
=========
3
3
4
- .. py :decorator :: pytest.mark.dependency(name = None , depends = [])
4
+ .. py :decorator :: pytest.mark.dependency(name = None , depends = [], scope = ' module ' )
5
5
6
6
Mark a test to be used as a dependency for other tests or to
7
7
depend on other tests.
@@ -11,16 +11,23 @@ Reference
11
11
for the test may be set in the depends argument.
12
12
13
13
:param name: the name of the test to be used for referencing by
14
- dependent tests. If not set, it defaults to the node ID
15
- defined by pytest, that is the name of the test function,
16
- extended by the parameters if applicable. The name must be
17
- unique in the scope, which is currently the test module.
14
+ dependent tests. If not set, it defaults to the node ID
15
+ defined by pytest, that is the name of the test function,
16
+ extended by the parameters if applicable. The name must be
17
+ unique in the scope, which is currently the test module.
18
18
:type name: :class: `str `
19
19
:param depends: dependencies, a list of names of tests that this
20
20
test depends on. The test will be skipped unless all of the
21
- dependencies have been run successfully. The dependencies
22
- must also have been decorated by the marker.
21
+ dependencies have been run successfully. The dependencies
22
+ must also have been decorated by the marker. The names of the
23
+ dependencies must be adapted to the scope.
23
24
:type depends: iterable of :class: `str `
25
+ :param scope: the scope to search for the dependencies. Must be
26
+ either `session `, `package `, `module `, or `class `.
27
+ :type scope: :class: `str `
28
+
29
+ .. versionchanged :: 0.5.0
30
+ the scope parameter has been added.
24
31
25
32
.. py :module :: pytest_dependency
26
33
0 commit comments