Empty __init__ and conftest files

527 views Asked by At

Is there any usage of empty __init__.py or conftest.py files in Python? Today I've had a discussion about it in my team and someone said that they may have an importance in testing with Pytest and checking code coverage.

1

There are 1 answers

4
Sami Tahri On

Conftest file is used by pytest to provide fixtures : Official doc

For __init__.py, it is used to declare packages, and ca be used to search modules in your directories. It can also be used to initialise code (this is the first thing that is executed when you import a module): doc

So, both are useful.