Skip to content

Multiple conftest and __init__.py across packages breaks pytest path resolving - how to solve it? #10708

Discussion options

You must be logged in to vote

I've found a working setup:

my_repo
├── README.md
└── my_repo
    ├── __init__.py
    ├── app
    │   ├── README.md
    │   ├── __init__.py
    │   ├── conftest.py
    │   ├── app
    │   │   └── __init__.py
    │   ├── poetry.lock
    │   ├── pyproject.toml
    │   └── tests
    │       ├── __init__.py
    │       └── test_app.py
    ├── conftest.py
    └── package1
        ├── README.md
        ├── __init__.py
        ├── conftest.py
        ├── package1
        │   └── __init__.py
        ├── poetry.lock
        ├── pyproject.toml
        └── tests
            ├── __init__.py
            └── test_package.py

To make it work:

  • conftest.py needs to be outside of tests folder
  • both my_repo

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@TranKiet97
Comment options

Answer selected by TomaszBorczyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants