4 ms·
Nitpick: I'd rather use the python -m pytest way than modify sys.path (AKA "the django way"). Modifying sys.path is an ugly hack which makes python look like s
by avip 7y ago
Nitpick: I'd rather use the python -m pytest way than modify sys.path (AKA "the django way").
Modifying sys.path is an ugly hack which makes python look like some... idk. matlab?
- zomglings 7y agoTotally agree with this. The guide presents a false dichotomy. The main package doesn't have to be in site-packages as the alternative to this sys.path hack. It just has to be accessible from your PYTHONPATH. Running tests as a module from the project root will put your main package on the PYTHONPATH.
- raziel2p 7y agoI don't understand what the author has against requiring a pip install -e . You're requiring contributors to install dependencies anyway. If you're using pytest (I think the article assumes you're only using the standard library unittest which I wouldn't personally recommend) there is pytest-pythonpath which at least makes this invisible to the user.