-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate tests to unittest framework #196
base: master
Are you sure you want to change the base?
Conversation
…ay status of ran tests
Incidentally, I think we should take a close look at the coverage report. Python code in s2plib which is never called during our end 2end tests is likely to be dead. A detailed html report can be generated afther tests execution with
|
Edits:
|
@jmichel-otb Right now it seems that running a specific test or group of tests doesn't work:
raises |
Actually I find the |
I apologize in advance because it is going to be a long answer to a short question. I tried to summarize it at the end. Disclaimer: I an mot a python test framewok expert, this is my personal experience so far speaking. Rational for choosing unitest over pytestI know that
|
Thank you @jmichel-otb for this detailed answer. I propose not to use any framework, neither As far as I understand, the main reasons for using a test framework are:
The first point will be solved once we have removed all intermediate i/o disk operations. A first step in this direction would be to merge PR #202 and PR #197, which together allow to run the first step of the pipeline (pointing correction) without writing files. The second point could be solved by turning the |
Summary
This PR migrates all our tests to a real unit test framework. I choosed unittest as it is the standard python framework, requiring no additional dependencies.
Implementation details:
testdata
moved totests
folders2p_test.py
has been moved totests
folder, rewritten withunittest
and split into different test file (one per module)test
makefile target have been updated to rununittest
with test discovery (and coverage fortravis-ci
)Running tests
All those command can be run from the s2p root folder.
All tests
$ make test
or
$ python -m unittest discover -s tests -p "*_test.py"
A specific test or group of tests
All tests in sift_test.py
All tests in TestSifts class in sift_test.py
A specific test in in TestSifts class in sift_test.py
Adding tests
Edit or create the corresponding test module for the module to be tested.
Coverage
As a cherry icing on the cake, I added coverage report to travis: