I have developed some very small projects with python, with their respective packages. So, I can execute setup.py and install them. However, I dont know the proper update procedure after developing a new version, or the proper procedure for comparing the new version against the stable version. Suppose that DoTask is the name of my stable package, with a function execute
from DoTask import execute
if __name__ == '__main__':
result = execute('path_to_data')
print result
How can I import the new version, for comparing results? How can I update the stable version, after testing and debugging?
For example, currently I do this:
1) I give the name DevDoTask to the developing version
from DoTask import execute
from DevDoTask import execute as test_execute
if __name__ == '__main__':
result = execute('path_to_data')
test_result = test_execute('path_to_data')
print result == test_result
Comparing the results to those of the previous version doesn’t seem like a good idea, because the previous version (although considered ‘stable’) can have bugs as well.
Consider creating a test suite using, for instance, the
unittestmodule. Maybe create a sample of the input data simple enough for you to know for sure what the results should be and hard-code those in the test (I don’t know if it’s a very good idea, but to me it looks better than comparing blindly to the previous results).