File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,28 @@ def pytest_collection_modifyitems(items, config):
108
108
# multi_vms implies small_vm
109
109
item .add_marker ('small_vm' )
110
110
111
+ # BEGIN make test results visible from fixtures
112
+ # from https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures
113
+
114
+ # FIXME we may have to move this into lib/ if fixtures in sub-packages
115
+ # want to make use of this feature
116
+ from pytest import StashKey , CollectReport
117
+ PHASE_REPORT_KEY = StashKey [dict [str , CollectReport ]]()
118
+
119
+ @pytest .hookimpl (wrapper = True , tryfirst = True )
120
+ def pytest_runtest_makereport (item , call ):
121
+ # execute all other hooks to obtain the report object
122
+ rep = yield
123
+
124
+ # store test results for each phase of a call, which can
125
+ # be "setup", "call", "teardown"
126
+ item .stash .setdefault (PHASE_REPORT_KEY , {})[rep .when ] = rep
127
+
128
+ return rep
129
+
130
+ # END make test results visible from fixtures
131
+
132
+
111
133
### fixtures
112
134
113
135
def setup_host (hostname_or_ip ):
You can’t perform that action at this time.
0 commit comments