@@ -29,15 +29,15 @@ def content_type_md(content_type):
2929 return ct
3030
3131
32- def record_to_md (record ):
32+ def record_to_md (record , initiators ):
3333 return f"""## { record .url }
3434
3535### initiator
3636
37- { record .initiator . short_label }
37+ { initiators [ record .initiator_id ]. label }
3838
3939```
40- { record .initiator .short_stack }
40+ { initiators [ record .initiator_id ] .short_stack }
4141```
4242
4343### request
@@ -100,7 +100,10 @@ def pytest_configure(config):
100100
101101@pytest .hookimpl (hookwrapper = True )
102102def pytest_runtest_protocol (item : pytest .Item , nextitem : Optional [pytest .Item ]):
103- if item .config .option .httpdbg or "HTTPDBG_SUBPROCESS_DIR" in os .environ :
103+ if item .config .option .httpdbg or (
104+ ("HTTPDBG_SUBPROCESS_DIR" in os .environ )
105+ and ("PYTEST_XDIST_WORKER" in os .environ )
106+ ):
104107 with httprecord (initiators = item .config .option .httpdbg_initiator ) as records :
105108 # the record of the http requests has been enable using a pytest command line argument
106109 # -> first, we stash the path to the log file
@@ -135,6 +138,6 @@ def pytest_runtest_protocol(item: pytest.Item, nextitem: Optional[pytest.Item]):
135138 ) as f :
136139 f .write (f"# { item .nodeid } \n \n " )
137140 for record in records :
138- f .write (f"{ record_to_md (record )} \n " )
141+ f .write (f"{ record_to_md (record , records . initiators )} \n " )
139142 else :
140143 yield
0 commit comments