File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,11 @@ def record_props(request, record_property):
105105def pytest_runtest_logreport (report ):
106106 """Send general test metrics to CloudWatch"""
107107
108+ # only publish metrics from the main process
109+ worker_id = os .environ .get ("PYTEST_XDIST_WORKER" )
110+ if worker_id is not None :
111+ return
112+
108113 # The pytest's test protocol has three phases for each test item: setup,
109114 # call and teardown. At the end of each phase, pytest_runtest_logreport()
110115 # is called.
@@ -135,6 +140,7 @@ def pytest_runtest_logreport(report):
135140 # and global
136141 {},
137142 )
143+ METRICS .set_property ("pytest_xdist_worker" , worker_id )
138144 METRICS .set_property ("result" , report .outcome )
139145 METRICS .set_property ("location" , report .location )
140146 for prop_name , prop_val in report .user_properties :
You can’t perform that action at this time.
0 commit comments