Skip to content

Enhanced nodeids to include line numbers #5241

@blueyed

Description

@blueyed

Pytest should handle an extended nodeid format of fname:lnum::func, which is would then use with the short test summary (for easier selection of tests in an editor).

The format currently is fname::func, which is good in terms of being stable across file changes and when referring to tests themselves, but for errors / test failures it should be more specific (i.e. include the line number).

An alternative might be fname::func:lnum, but this is not that easy for editors to parse (but basically you would have to ignore the "::func" therin.

As for the short test summary, it could also just display fname:lineno there, but I think it is useful to have the test name there also.

Originally posted by @blueyed in #5002 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: reportingrelated to terminal output and user-facing messages and errorstype: proposalproposal for a new feature, often to gather opinions or design the API around the new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions