Skip to content

Running pytest with "--pyargs" will result in Items with empty "parent.nodeid" if run from a different root directory #2775

@cboelsen

Description

@cboelsen

When running pytest with "--pyargs" from a directory that isn't a parent directory of the packages under test, then the Items created will have an empty parent.nodeid (i.e. "::test_function").

This is because the _makeid() method in FSCollector compares the path of the Module to the rootdir:

relpath = self.fspath.relto(self.config.rootdir)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions