myproject/
bin/
myscript
mypackage/
__init__.py
core.py
tests/
__init__.py
test_mypackage.py
setup.py
What is the best way to test the script myscript?
From SO research, it seems the only answer I've found is to write a test in tests called test_myscript and use something like
import subprocess
process = subprocess.Popen('myscript arg1 arg2')
print process.communicate()
in my test case to run the script and then test the results. Is there a better way? Or any other suggestions for different ways? And should I put the test suite in bin/tests or in mypackage/tests?