source: https://docs.pytest.org/en/latest/goodpractices.html If you need to have test modules with the same name, you might add __init__.py files to your tests folder and subfolders, changing them to packages: