Request: Add notes about where to put unit tests
I did some Googling. None of the pages have very good explanations of where to put your unit test files.
Also, AFAIK (I am a Python newbiew) there are some drawbacks to <project_root>/test/ about importing. Might need to modify PYTHONPATH during unit test runs.
Also, please talk about why init.py is important for unit tests. A few places recommend it... but I thought it was dead in Python3.
Ref: http://pytest.org/latest/goodpractises.html Ref: http://stackoverflow.com/questions/5341006/where-should-i-put-tests-when-packaging-python-modules Ref: http://stackoverflow.com/questions/61151/where-do-the-python-unit-tests-go
@kevinarpe there really isn't one best practice place of locating tests. Several projects do it radically different. Some go so far as to host their tests in an entirely separate repository.
There are some strongly expressed opinions here, specifically "you're going to test the wrong code if you don't test the installed code." http://blog.ionelmc.ro/2014/05/25/python-packaging/ There is also cookiecutter-pylibrary linked from there that implements this set of best practices
I'm not sure if this is pertinent, but I didn't want to open a new issue... I'm trying to write tests, and I'm working on this section. In my tests modules, adding from .context import sample give me the following error: ModuleNotFoundError: No module named '__main__.context'; '__main__' is not a package
I have followed the guide exactly, but I can't run my tests! Do you have any tips?