Azure / pytest-azurepipelines

Plugin for pytest that makes it simple to work with Azure Pipelines
MIT License
113 stars 35 forks source link

Refs #20: Make nodeID modification opt-in. #22

Closed freakboy3742 closed 5 years ago

freakboy3742 commented 5 years ago

pytest_collection_modifyitems sets _nodeid on the test item. This accommodates "napoleon" docstring format, as well as introducing docstring-based nodeID formatting.

As per pytest-dev/pytest#5259, nodeID is intended to be a read-only property. pytest-azurepipeline's modification of _nodeid breaks plugins that rely on nodeid as a node identifier.

I've retained the "napolean" option here on the assumption that it's being used by someone, even though it's relying on an internal that is meant to be readonly. I suspect the real fix here is to inject the test docstring as part of the reporting phase, rather than the collection phase - although that may not be possible with the metadata that is currently being passed from test Items to the report.

See #19 for an alternate approach to this problem (making the "clean", no-modification behavior opt-in).

tonybaloney commented 5 years ago

Thanks @freakboy3742 this is a good strategy, ideally the XML component of pytest would have an attribute I could write to instead of setting _nodeid.

The number of plugins this has broken outweighs the benefit

👍