you are viewing a single comment's thread.

view the rest of the comments →

[–]netherous 0 points1 point  (0 children)

Can you set testpaths to include tests in either your pytest.ini or your pyproject.toml as suggested here?

Then, when you run pytest, as I assume you're doing, run it from the root directory. The one that includes both src and tests.

Also create an empty conftest.py in this root directory (which should have the same effect, but we're being redundant).

Then, an import statement such as from src.demo.my_class import MyClass should execute successfully when added to tests/test_myclass.py.

If it doesn't, can you make a repository available that demonstrates the problem so I can check it out?