Skip to content
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

fix: Find pyproject.toml in upper directories #160

Merged
merged 7 commits into from
Dec 21, 2024

Conversation

pawamoy
Copy link
Contributor

@pawamoy pawamoy commented Dec 19, 2024

Previously, the code assumed that pyproject.toml was located next to the Pytest config file, which is not always the case. Now we simply climb up the directory tree to search for the closest pyproject.toml. Let me know if you think of a better approach 🙂

@pawamoy
Copy link
Contributor Author

pawamoy commented Dec 19, 2024

Ah, I should probably handle the case where a pyproject.toml file is never found, otherwise we'll get an infinite loop. What should we do if there's no pyproject.toml by the way?

@pawamoy pawamoy marked this pull request as draft December 19, 2024 20:38
@15r10nk
Copy link
Owner

15r10nk commented Dec 19, 2024

What should we do if there's no pyproject.toml by the way?

There is already a check in read_config() and it will give you a Config with defaults.

@pawamoy pawamoy marked this pull request as ready for review December 19, 2024 21:10
@15r10nk
Copy link
Owner

15r10nk commented Dec 20, 2024

The code is covered, but only because it searches all the way down to /.
A test which checks if it can find a pyproject.toml in a upper directory would be useful.

And also documentation and a changelog entry.

@pawamoy
Copy link
Contributor Author

pawamoy commented Dec 21, 2024

Nice simplification of the test 👍

@15r10nk 15r10nk merged commit df78b7f into 15r10nk:main Dec 21, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants