Skip to content

Confusing interaction between rootdir and pytest.ini #6376

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nicoddemus opened this issue Dec 28, 2019 · 4 comments
Open

Confusing interaction between rootdir and pytest.ini #6376

nicoddemus opened this issue Dec 28, 2019 · 4 comments
Labels
topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature

Comments

@nicoddemus
Copy link
Member

nicoddemus commented Dec 28, 2019

From #6359 (comment):

Unfortunately I agree that the current interaction between rootdir and ini files is far from clear, and someone just looking at --rootdir would assume that it should point to the root of your repository/project, and from there on pytest would find pytest.ini files and start collection, but this is currently not the case.

I've seen more than one issue popping up about this confusion: people assume that --rootdir mydir implies that pytest will look for pytest.ini files and start collection from mydir, which is not the case at all currently.

I think we should change the meaning of --rootdir the option somehow, because I believe it is the main source of confusion, while I don't think it happens when rootdir is found automatically.

An initial proposal:

--rootdir when given:

  • Will set config.rootdir to that value (of course).
  • Will search from --rootdir and upwards for pytest.ini files.
  • If no paths are given in the command line, it will act like testpaths, where collection will be assumed to start from --rootdir.

Thoughts?

It is a change in existing behavior, but I think --rootdir is rarely used, and when used people are usually confused by it.

@nicoddemus nicoddemus added topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature labels Dec 28, 2019
@erheron
Copy link
Contributor

erheron commented Jan 15, 2020

I was experiencing troubles with understanding of what --rootdir really is too. Maybe it should be issue of documentation rework (for example we could add there some explicit information about what rootdir isn't)?

@RonnyPfannschmidt
Copy link
Member

RonnyPfannschmidt commented Jan 15, 2020

if we change the meaning, we should pick a good name, and deprecate the old argument

@nicoddemus
Copy link
Member Author

if we change the meaning, we should pick a good name, and deprecate the old argument

Any suggestions @RonnyPfannschmidt ? I'm thinking this would be a good addition to 6.0.

@nicoddemus
Copy link
Member Author

Another issue related to this: #7888

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: config related to config handling, argument parsing and config file type: proposal proposal for a new feature, often to gather opinions or design the API around the new feature
Projects
None yet
Development

No branches or pull requests

3 participants