nicoulaj / pytest-csv

CSV reporter for pytest.
GNU General Public License v3.0
21 stars 16 forks source link

Emit (failure) rows for tests that crashed without leaving a report #10

Closed eli-b closed 5 years ago

eli-b commented 5 years ago

Currently, when an xdist worker crashes while running a test, no CSV row is emitted at all. The test I added in this PR demonstrates this (when added without the rest of my changes).

This PR fixes this behavior.

An issue arises with column functions: when running with xdist, the master doesn't run test collection, so when it produces the failure report for the test the worker was running while the worker crashed, it doesn't have an item object to supply the column function. In this PR I propose that in such cases the column functions be passed None as the item argument, and that they be run under a "best-effort" assumption - if a column function fails its column would simply be empty. Column functions might fail because they might expect field on the item or on the report that would be missing in this scenario.

nicoulaj commented 5 years ago

Agree on issue and fix, thanks for contributing !

eli-b commented 5 years ago

That was quick, thanks!