Skip to content

Conversation

@RonnyPfannschmidt
Copy link
Member

Summary

Refactors Node constructors to be simple assignment-only, moving all derivation logic to from_parent factory methods.

Changes

  • Node.from_parent computes config/session from parent
  • FSCollector.from_parent computes name/nodeid from path
  • Item.from_parent performs diamond inheritance check before construction
  • Session.from_config handles plugin registration post-construction
  • Removed fspath parameter (was PytestRemovedIn9Warning)
  • Removed non-cooperative constructor fallback in NodeMeta._create

Blockers

This PR depends on prior changes that need separate PRs first:

  1. Diamond inheritance warning registration - The warning is currently registered incorrectly and needs fixing before this can land

Opening as draft to preserve work-in-progress state. Not ready for review.

This refactoring moves derivation logic from Node __init__ methods to
from_parent factory methods, making constructors simpler (assignment-only).

Changes:
- Node.from_parent now computes config/session from parent
- FSCollector.from_parent now computes name/nodeid from path
- Item.from_parent performs diamond inheritance check before construction
- Session.from_config handles plugin registration post-construction
- Package, Function, DoctestItem made cooperative (accept **kwargs)
- Removed legacy fspath parameter support (was PytestRemovedIn9Warning)
- Removed non-cooperative constructor fallback in NodeMeta._create
- Updated tests to use cooperative constructors

Note: Diamond inheritance (Item + Collector) warning registration needs
to be addressed in a separate PR before this can be finalized.

Co-authored-by: Cursor AI <[email protected]>
Co-authored-by: Anthropic Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant