Skip to content Skip to sidebar Skip to footer

How Can I Structure My Folders To Test My Code:

I'm working on a project and would like to write some unit tests for my code. Here is a minimal example of my project structure myproject └── scripts ├── tests

Solution 1:

You need to add (empty) __init__.py files to the directories scripts/ and scripts/tests/. These files provide the scaffolding that lets import find modules, especially when using relative imports.

The __init__.py files are required to make Python treat directories containing the file as packages.

From https://docs.python.org/3/tutorial/modules.html

Post a Comment for "How Can I Structure My Folders To Test My Code:"