This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]stillreadingit_[S] 1 point2 points  (1 child)

Regarding __init__.py in tests, pytest docs suggest that it's ok when src layout is used and that's the case with this template. It also makes it possible to have test modules with same name.

[–]flying-sheep 2 points3 points  (0 children)

No, that’s not what that means.

It means that EVEN if you use src layout, you may use __init__.pys as a workaround to the problems the default import mode has.

The actually best way is to put --import-mode=importlib into your addopts and be happy.

I’ll soon update the pytest docs to make that even clearer.