I have a module that sits in a namespace. Should tests and data the tests rely on go in the namespace or in the top level where setup.py sites?
./company/__init__.py ./company/namespace/__init__.py ./company/namespace/useful.py ./company/namespace/test_useful.py ./company/namespace/test_data/useful_data.xml ./setup.py
or
./company/__init__.py ./company/namespace/__init__.py ./company/namespace/useful.py ./test_useful.py ./test_data/useful_data.xml ./setup.py
Does the question amount to whether tests should be installed or not?
The Sample Project stores the tests outside the module.
The directory structure looks like this:
├── data │ └── data_file ├── MANIFEST.in ├── README.rst ├── sample │ ├── __init__.py │ └── package_data.dat ├── setup.cfg ├── setup.py └── tests ├── __init__.py └── test_simple.py
Related: The Packing Guide: https://packaging.python.org/en/latest/
Hint: Don't follow the "The Hitchhiker's Guide to Packaging". It has not been updated since 2010!
(do not confuse both pages. The "The Hitchhiker’s Guide to Python" is a very solid book)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With