Skip to content

Mention pythonpath in the getting started/goodpractices documentation #9833

@nicoddemus

Description

@nicoddemus

Originally posted by @LuminairPrime in #9134 (comment)

I was just going in circles for a while looking for this exact feature, lol! Everyone on the internet recommends pytest for Python testing, but nobody mentions how to actually get it working when your source and tests aren't next to each other. There are countless google hits for people suggesting "sys.path.append" code snippits. It's the wild west out there.

Maybe I should make a feature request for this. I think it would be good to add some mention in the basic documentation. For example, the files:
https://docs.pytest.org/en/7.1.x/getting-started.html
https://docs.pytest.org/en/7.1.x/explanation/goodpractices.html

When there's mention of 1) starting a new project, or 2) a project directory hierarchy, there should be mention of setting pythonpath in pyproject.toml to include your source path. It should be assumed that normies like me are reading this documentation and just want to get their first unit test on their first program to run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions