userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
service.py
1
"""Supplementary types and functions for @ref pytest_userver.plugins.service."""
2
3
from
collections.abc
import
Callable
4
import
dataclasses
5
6
from
pytest_userver
import
fixture_markers
7
8
# @cond
9
10
11
@dataclasses.dataclass(frozen=True)
12
class
_ServiceDependencyInfo:
13
pass
14
15
16
# @endcond
17
18
19
def
dependency
(func: Callable[..., object]) -> Callable[..., object]:
20
"""
21
Mark a pytest fixture as a service dependency. This fixture will automatically
22
be depended on by
23
@ref pytest_userver.plugins.service.service_daemon_instance "service_daemon_instance"
24
fixture.
25
26
Apply to the original function, under `@pytest.fixture`.
27
28
Overrides inherit this mark automatically; repeating the decorator is not
29
required, even if the override does not request the original fixture.
30
The dependency resolves to the overriding fixture, not the original one.
31
32
@snippet samples/http_caching/tests/conftest.py service dependency
33
34
@see @ref fixture_markers_overrides "Fixture marker inheritance"
35
36
@ingroup userver_testsuite
37
"""
38
return
fixture_markers.mark(func, _ServiceDependencyInfo())
testsuite
pytest_plugins
pytest_userver
service.py
Generated on
for userver by
Doxygen
1.17.0