⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
userver
C++ Async Framework v2.0
Documentation
API Groups
Namespaces
Reference
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
y
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
w
y
Variables
k
n
r
u
w
Typedefs
c
d
h
m
n
o
p
s
t
u
v
Enumerations
a
b
c
d
f
h
i
l
o
p
r
s
t
u
v
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
Enumerations
Enumerator
Related Symbols
File List
File Members
All
e
i
l
r
t
u
Functions
Macros
e
i
l
r
t
u
Examples
Toggle main menu visibility
▼
userver
Documentation
►
API Groups
►
Namespaces
▼
Reference
►
Namespace Members
►
Class List
Class Index
►
Class Hierarchy
►
Class Members
▼
File List
►
en
▼
testsuite
▼
pytest_plugins
▼
pytest_userver
▼
plugins
►
grpc
►
ydb
__init__.py
base.py
caches.py
clickhouse.py
config.py
core.py
dumps.py
dynamic_config.py
log_capture.py
logging.py
mongo.py
mysql.py
postgresql.py
rabbitmq.py
redis.py
service.py
service_client.py
service_runner.py
testpoint.py
►
utils
__init__.py
chaos.py
client.py
metrics.py
sql.py
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
userver
►
File Members
►
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
Loading...
Searching...
No Matches
All results
testpoint.py
1
"""
2
Testpoints support for the server.
3
"""
4
5
# pylint: disable=redefined-outer-name
6
import
typing
7
8
import
pytest
9
10
USERVER_CONFIG_HOOKS = [
'userver_config_testpoint'
]
11
12
13
class
BaseError
(Exception):
14
pass
15
16
13
class
BaseError
(Exception):
…
17
class
UnregisteredTestpointError
(
BaseError
):
18
pass
19
20
17
class
UnregisteredTestpointError
(
BaseError
):
…
21
class
TestpointControl
:
22
def
__init__(self):
23
self.enabled_testpoints: typing.FrozenSet[str] = frozenset()
24
25
21
class
TestpointControl
:
…
26
DISABLED_ERROR =
"""Access to {opname!r} on unregistered testpoint {name}
27
28
Use `await service_client.update_server_state()` to explicitly sync testpoints
29
state.
30
"""
31
32
33
@pytest.fixture
34
def
testpoint_control():
35
return
TestpointControl
()
36
37
38
@pytest.fixture
39
def
testpoint_checker_factory(testpoint_control):
40
def
create_checker(name):
41
def
checker(opname):
42
if
name
not
in
testpoint_control.enabled_testpoints:
43
raise
UnregisteredTestpointError
(
44
DISABLED_ERROR.format(opname=opname, name=name),
45
)
46
47
return
checker
48
49
return
create_checker
50
51
52
@pytest.fixture(scope='session')
53
def
userver_config_testpoint
(mockserver_info):
54
"""
55
Returns a function that adjusts the static configuration file for
56
the testsuite.
57
Sets the `tests-control.skip-unregistered-testpoints` to `True`.
58
59
@ingroup userver_testsuite_fixtures
60
"""
61
62
def
_patch_config(config_yaml, config_vars):
63
components = config_yaml[
'components_manager'
][
'components'
]
64
tests_control = components.get(
'tests-control'
)
65
if
tests_control:
66
tests_control[
'skip-unregistered-testpoints'
] =
True
67
68
return
_patch_config
53
def
userver_config_testpoint
(mockserver_info):
…
Docs version:
v1.0
,
v2.0
,
trunk/develop
testsuite
pytest_plugins
pytest_userver
plugins
testpoint.py
Generated on Wed May 15 2024 22:31:38 for userver by
Doxygen
1.10.0