issue a warning when Item and Collector are used in diamond inheritance (#8447)

* issue a warning when Items and Collector form a diamond

addresses #8435

* Apply suggestions from code review

Co-authored-by: Ran Benita <ran@unusedvar.com>

* Return support for the broken File/Item hybrids

* adds deprecation
* ads necessary support code in node construction

* fix incorrect mypy based assertions

* add docs for deprecation of Item/File inheritance

* warn when a non-cooperative ctor is encountered

* use getattr instead of cast to get the class __init__ for legacy ctors

* update documentation references for node inheritance

* clean up file+item inheritance test

enhance docs
move import upwards

Co-authored-by: Ran Benita <ran@unusedvar.com>
This commit is contained in:
Ronny Pfannschmidt
2021-06-24 11:45:32 +02:00
committed by GitHub
parent 942789bace
commit d7b0e17205
5 changed files with 122 additions and 17 deletions

View File

@@ -0,0 +1,4 @@
Defining a custom pytest node type which is both an item and a collector now issues a warning.
It was never sanely supported and triggers hard to debug errors.
Instead, a separate collector node should be used, which collects the item. See :ref:`non-python tests` for an example.