My Python project is currently suffering from issues where my dependencies have conflicts. I wanted to solve that later, after I finished writing tests for a specific function in my code (function_a.py in file_a.py).
When I run pytest explicitly on the test file in this directory (pytest test_a.py) everything is fine and my tests pass. But if I add an __init__.py file to this directory my code errors due to the conflict between the dependencies (which are imported in the __init__.py file of the parent directory).
Works:
- parent_directory
- other_files.py
- __init__.py
- child_directory
- file_a.py
- test_a.py
Does not work:
- parent_directory
- other_files.py
- __init__.py
- child_directory
- file_a.py
- test_a.py
- __init__.py
Why does the __init__.py in the child_directory causes my other __init__.py in the parent_directory to be executed?