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

Support src directory layout #33

Open
toracle opened this issue Apr 2, 2022 · 0 comments
Open

Support src directory layout #33

toracle opened this issue Apr 2, 2022 · 0 comments

Comments

@toracle
Copy link

toracle commented Apr 2, 2022

In pytest documentation, they also recommend to use src directory layout.

This is problematic if you are using a tool like tox to test your package in a virtual environment, because you want to test the installed version of your package, not the local code from the repository.

In this situation, it is strongly suggested to use a src layout where application root package resides in a sub-directory of your root:

This layout prevents a lot of common pitfalls and has many benefits, which are better explained in this excellent blog post by Ionel Cristian Mărieș.

To run pytest with this layout, we need override PYTHONPATH to ./src, so need to run pytest like PYTHONPATH=src pytest. Don't we need to provide a way to override PYTHONPATH? I'll dig on it.

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

No branches or pull requests

1 participant