Skip to content

tighten Node.parent to Collector and resolve the resulting typing issues #8244

Closed

Description

@RonnyPfannschmidt

Can this be Collector? (Although would be a typing breaking change for from_parent...)

Originally posted by @bluetech in #8037 (comment)

Activity

  1. added
    type: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelog
    on Jan 16, 2021
  2. RonnyPfannschmidt commented on Sep 13, 2026

    @RonnyPfannschmidt
    MemberAuthor

    I asked Claude Opus 5 (via Claude Code) to check whether this issue is still live. The investigation and the text below are its work; I read it and I am posting it.

    Resolved by #14758.

    Node.parent is now annotated Collector | None (src/_pytest/nodes.py:152), and Collector.from_parent takes parent: Collector (nodes.py:219) — the tightening this issue asked for. The change landed as part of "Replace string nodeids with a structured NodeId internally" (431f3e1), which is why it was never linked here.

    Closing as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: backward compatibilitymight present some backward compatibility issues which should be carefully noted in the changelogtype: refactoringinternal improvements to the code

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions