Skip to content

Pytest adds parent instead of expected directory into python path. (shouldn't it add rootdir?) #2589

Description

@cepbrian

Using pytest 3.1.3, python 2.7, OSX 10.12.5

Looking at https://docs.pytest.org/en/latest/customize.html Which appears to be the most recent documentation.

Documentation says that it looks for pytest.ini to find rootdir. Instead it looks up from tests dir until it finds a dir without init.py.

I'm not sure if this is a documentation error, a linking error in the docs (It's not pointing to the most recent version of the docs somehow) or an actual error in the code. I'm guessing it's just that the docs aren't up to date, but that's just a guess.

EDIT:

It appears that I asked the wrong question. (leaving it there for clarity)

The question isn't actually about rootdir. The issue is that the documentation doesn't clearly say what pytest puts in PYTHONPATH. As such, I assumed it put rootdir. And so I assumed it was not setting rootdir correctly. It turns out that it is setting rootdir just fine, but it doesn't use rootdir in pythonpath at all.

I believe that there should be some (perhaps just some easier to find) documentation on how pytest sets pythonpath.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions