userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
config.py
1
"""Supplementary types and functions for @ref pytest_userver.plugins.config."""
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
_ConfigPatchInfo:
13
pass
14
15
16
# @endcond
17
18
19
def
patch
(func: Callable[..., object]) -> Callable[..., object]:
20
"""
21
Mark a pytest fixture as a static config patch. The fixture will automatically
22
be applied to the service config.
23
24
Apply to the original function, under `@pytest.fixture`.
25
26
Overrides inherit this mark automatically; repeating the decorator is not
27
required, even if the override does not request the original fixture.
28
The override keeps the original marked fixture's position in patch order.
29
30
@snippet samples/static_service/testsuite/conftest.py static config patch
31
32
@see @ref fixture_markers_overrides "Fixture marker inheritance"
33
34
@ingroup userver_testsuite
35
"""
36
return
fixture_markers.mark(func, _ConfigPatchInfo())
testsuite
pytest_plugins
pytest_userver
config.py
Generated on
for userver by
Doxygen
1.17.0