pytest-xdist icon indicating copy to clipboard operation
pytest-xdist copied to clipboard

How Master node can know info from Worker nodes after call pytest_collection_modifyitems?

Open voloxastik opened this issue 1 year ago • 8 comments

Hello everyone! I am using Terstrail plugin to report. So I need to know the list of test cases collected when calling pytest_collection_modifyitems on each node. Do you know how I can know this? Thanks.

voloxastik avatar Jan 10 '24 14:01 voloxastik

Xdist only sends the nodes to the coordinator after modifyitems

Would the collection Reports come in handy

RonnyPfannschmidt avatar Jan 10 '24 14:01 RonnyPfannschmidt

pytest_collection_modifyitems have workeroutput, but I not see in them in hook pytest_xdist_node_collection_finished

voloxastik avatar Jan 10 '24 14:01 voloxastik

Xdist only sends the nodes to the coordinator after modifyitems

Would the collection Reports come in handy

could you explain more about what report you mean?

voloxastik avatar Jan 10 '24 14:01 voloxastik

i did mean the collection reports, however i just took note, that those will not serialize the node details over the wire

without more details on your use-case i cant give a meaningfull answer

RonnyPfannschmidt avatar Jan 10 '24 15:01 RonnyPfannschmidt

I need a list of testrail cases that was generated when pytest_collection_modifyitems was executed. After that I need to get this information from all nodes. and create a test run in testrail before push result

voloxastik avatar Jan 10 '24 17:01 voloxastik

I need a list of testrail cases that was generated when pytest_collection_modifyitems was executed. After that I need to get this information from all nodes. and create a test run in testrail before push result

You should be able to use a hookwrapper for that.

nicoddemus avatar Jan 11 '24 16:01 nicoddemus

@nicoddemus The question is not about writing a handler, but how to get the data after running the hook pytest_collection_modifyitems on each node to the master and execute something on the master after that and before running the tests.

voloxastik avatar Jan 11 '24 17:01 voloxastik

See pytest_xdist_node_collection_finished, I think you might be able to keep the nodeids for each work around, and then do something later once the collection finishes.

nicoddemus avatar Jan 11 '24 17:01 nicoddemus