Skip to content

Support src directory layout #33

@toracle

Description

@toracle

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions