Enumeration types for the pytest-item-dict plugin.
This module defines :class:INIOptions, :class:CollectTypes, and
:class:TestProperties, which centralise every string constant used by the
plugin, eliminating hard-coded literals and making future refactors safer.
| Attributes: |
-
INIOptions
(StrEnum)
–
Keys for pytest ini-file configuration options.
-
CollectTypes
(StrEnum)
–
String names of pytest collector node types.
-
TestProperties
(StrEnum)
–
Attribute names used to annotate :class:pytest.Item objects and
hierarchy dict nodes during a test run.
|
CollectTypes
Bases: StrEnum
String representations of pytest collector node type().__name__ values.
| Attributes: |
-
DIR
(str)
–
A plain directory node (pytest.Dir).
-
PACKAGE
(str)
–
A Python package directory (pytest.Package).
-
MODULE
(str)
–
A .py test module (pytest.Module).
-
CLASS
(str)
–
A test class (pytest.Class).
-
TEST
(str)
–
An individual test function/method (pytest.Function).
|
Source code in src/pytest_item_dict/item_dict_enums.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82 | class CollectTypes(StrEnum):
"""String representations of pytest collector node ``type().__name__`` values.
Attributes
----------
DIR : str
A plain directory node (``pytest.Dir``).
PACKAGE : str
A Python package directory (``pytest.Package``).
MODULE : str
A ``.py`` test module (``pytest.Module``).
CLASS : str
A test class (``pytest.Class``).
TEST : str
An individual test function/method (``pytest.Function``).
"""
DIR = "Dir"
PACKAGE = "Package"
MODULE = "Module"
CLASS = "Class"
TEST = "Test"
|
INIOptions
Bases: StrEnum
Pytest ini-file option keys recognised by the plugin.
| Attributes: |
-
CREATE_ITEM_DICT
(str)
–
Master switch; when False the plugin is not registered.
-
UPDATE_DICT_ON_TEST
(str)
–
Update the test-outcome hierarchy dict after every individual test.
-
SET_COLLECT_MARKERS
(str)
–
Persist pytest markers into the collection hierarchy dict.
-
SET_TEST_OUTCOMES
(str)
–
Persist test outcomes (passed/failed/skipped/unexecuted) into the
test-run hierarchy dict.
-
SET_TEST_DURATIONS
(str)
–
Persist individual and aggregated durations into the test-run dict.
-
SET_TEST_MARKERS
(str)
–
Persist pytest markers into the test-run hierarchy dict.
-
SET_TEST_HIERARCHY_OUTCOMES
(str)
–
Aggregate outcome counts (@counts) at every non-leaf hierarchy node.
-
SET_TEST_HIERARCHY_DURATIONS
(str)
–
Aggregate total durations (@total_duration) at every non-leaf hierarchy
node.
|
Source code in src/pytest_item_dict/item_dict_enums.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58 | class INIOptions(StrEnum):
"""Pytest ini-file option keys recognised by the plugin.
Attributes
----------
CREATE_ITEM_DICT : str
Master switch; when ``False`` the plugin is not registered.
UPDATE_DICT_ON_TEST : str
Update the test-outcome hierarchy dict after every individual test.
SET_COLLECT_MARKERS : str
Persist pytest markers into the *collection* hierarchy dict.
SET_TEST_OUTCOMES : str
Persist test outcomes (passed/failed/skipped/unexecuted) into the
test-run hierarchy dict.
SET_TEST_DURATIONS : str
Persist individual and aggregated durations into the test-run dict.
SET_TEST_MARKERS : str
Persist pytest markers into the *test-run* hierarchy dict.
SET_TEST_HIERARCHY_OUTCOMES : str
Aggregate outcome counts (``@counts``) at every non-leaf hierarchy node.
SET_TEST_HIERARCHY_DURATIONS : str
Aggregate total durations (``@total_duration``) at every non-leaf hierarchy
node.
"""
CREATE_ITEM_DICT = "create_item_dict"
UPDATE_DICT_ON_TEST = "update_dict_on_test"
SET_COLLECT_MARKERS = "set_collect_dict_markers"
SET_TEST_OUTCOMES = "set_test_dict_outcomes"
SET_TEST_DURATIONS = "set_test_dict_durations"
SET_TEST_MARKERS = "set_test_dict_markers"
SET_TEST_HIERARCHY_OUTCOMES = "set_test_hierarchy_dict_outcomes"
SET_TEST_HIERARCHY_DURATIONS = "set_test_hierarchy_dict_durations"
SET_SETUP_TEARDOWN = "set_test_dict_setup_teardown"
|
TestProperties
Bases: StrEnum
Attribute names stored on :class:pytest.Item objects and in hierarchy dicts.
Keys prefixed with @ in the hierarchy dict correspond to these values
via :meth:~pytest_item_dict.collect_dict.CollectionDict.set_attribute.
| Attributes: |
-
OUTCOME
(str)
–
Test execution result: "passed", "failed", "skipped",
or "unexecuted".
-
NODEID
(str)
–
Full pytest node identifier (e.g. suite/test_mod.py::Cls::test_fn).
-
NAME
(str)
–
Short test name without path information.
-
ORIGINAL_NAME
(str)
–
Original test name before any parametrize renaming.
-
MARKERS
(str)
–
List of marker names attached to the test.
-
DURATION
(str)
–
Individual test duration in seconds (float).
-
COUNTS
(str)
–
Aggregated outcome counts at a parent node; stored as
{"passed": N, "failed": N, "skipped": N, "unexecuted": N, "total": N}.
-
TOTAL_DURATION
(str)
–
Aggregated sum of child-node durations at a parent node (float, seconds).
|
Source code in src/pytest_item_dict/item_dict_enums.py
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122 | class TestProperties(StrEnum):
"""Attribute names stored on :class:`pytest.Item` objects and in hierarchy dicts.
Keys prefixed with ``@`` in the hierarchy dict correspond to these values
via :meth:`~pytest_item_dict.collect_dict.CollectionDict.set_attribute`.
Attributes
----------
OUTCOME : str
Test execution result: ``"passed"``, ``"failed"``, ``"skipped"``,
or ``"unexecuted"``.
NODEID : str
Full pytest node identifier (e.g. ``suite/test_mod.py::Cls::test_fn``).
NAME : str
Short test name without path information.
ORIGINAL_NAME : str
Original test name before any parametrize renaming.
MARKERS : str
List of marker names attached to the test.
DURATION : str
Individual test duration in seconds (``float``).
COUNTS : str
Aggregated outcome counts at a parent node; stored as
``{"passed": N, "failed": N, "skipped": N, "unexecuted": N, "total": N}``.
TOTAL_DURATION : str
Aggregated sum of child-node durations at a parent node (``float``, seconds).
"""
OUTCOME = "outcome"
NODEID = "nodeid"
NAME = "name"
ORIGINAL_NAME = "original_name"
MARKERS = "markers"
DURATION = "duration"
COUNTS = "counts"
TOTAL_DURATION = "total_duration"
SETUP_OUTCOME = "setup_outcome"
TEARDOWN_OUTCOME = "teardown_outcome"
|