Data files for tests

S

Steven D'Aprano

I have a package with some tests. The tests are not part of the package
itself, so I have a laid out my files like this:


src/
spam/
__init__.py
other-files.py
test_spam.py


Some of the tests depend on external data files. Where should I put them?
In the same directory as test_spam?
 
E

Ethan Furman

Steven said:
I have a package with some tests. The tests are not part of the package

Do you mean they are not importable, as in

--> from spam import tests

or they are not distributed? Because it seems to me that distributing
them would be worthwhile to at least some of the folks downloading your
package (assuming you distribute it).

For myself, I do keep my tests in a folder in the package itself --
keeps it out of the way (any necessary files also go there).

~Ethan~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,242
Latest member
KendrickKo

Latest Threads

Top