Great introduction.
I have one question: you have tests inside the project directory, while this guide places both docs and tests into the git root. Are there any up- or down-sides to either of the choices?
My method just makes the imports a lot easier. You'll notice that the guide you linked to requires some complex imports for the tests to work, whereas my approach requires nothing of the sort, since tests are part of the module.
I suppose if you absolutely don't want to ship tests as part of your finished product, that might justify the other approach. That said, I prefer to always ship tests in the project; it makes debugging on another system a lot more feasible.
So, in your approach, how do you import, let's say game_item.py from test_game_item.py?
And does it then have to be run from a specific folder (omission-git, omission-git/omission/, or omission-git/omission/tests) or does it work from all the above?
Great introduction.
I have one question: you have
tests
inside the project directory, while this guide places bothdocs
andtests
into the git root. Are there any up- or down-sides to either of the choices?My method just makes the imports a lot easier. You'll notice that the guide you linked to requires some complex imports for the tests to work, whereas my approach requires nothing of the sort, since tests are part of the module.
I suppose if you absolutely don't want to ship tests as part of your finished product, that might justify the other approach. That said, I prefer to always ship tests in the project; it makes debugging on another system a lot more feasible.
Good point, thanks.
So, in your approach, how do you
import
, let's saygame_item.py
fromtest_game_item.py
?And does it then have to be run from a specific folder (
omission-git
,omission-git/omission/
, oromission-git/omission/tests
) or does it work from all the above?Within
omission/tests/test_game_item.py
, I would import that other module via...I always run
python -m omission
orpytest omission
from withinomission-git
.