-
Notifications
You must be signed in to change notification settings - Fork 438
Switch to pytest and add optional Python 3.8 test #380
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
Switch to pytest and add optional Python 3.8 test #380
Conversation
1 similar comment
For some reason the Without the |
a03ea58
to
53202aa
Compare
Rebased changes on top of master to get some of the fixes from #366 the eased precision on some of the tests. |
@@ -118,7 +130,7 @@ install: | |||
# command to run tests | |||
script: | |||
- 'if [ $SLYCOT != "" ]; then python -c "import slycot"; fi' | |||
- coverage run setup.py test | |||
- coverage run -m pytest --disable-warnings control/tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is --disable-warnings
needed? I would rather have them printed and give every contributor the opportunity to fix problems early before e.g. DeprecationWarnings
turn into errors after a Python or some library update.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 18,209 warning messages and unfortunately pytest prints error messages first => I found it hard to locate the errors. Most of the warnings seem to be around the use of numpy.matrix
, which I figure we will get rid of starting in v0.9.0.
control/tests/freqresp_test.py
Outdated
def suite(): | ||
return unittest.TestLoader().loadTestsFromTestCase(TestTimeresp) | ||
return unittest.TestLoader().loadTestsFromTestCase(TestFreqresp) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is code from the unittest framework. Pytest does not use it. IMHO, let's remove suite()
and the __main__
sections from all test files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the suite()
functions, which were often not properly set up and were only used in tests/run_all.py
, which I don't think we were using anyway.
I left in the __main__
sections, so that you could (if you wanted) call a test script directly (rather than having to use pytest
).
* switch Travis to use pytest instead of deprecated setup.py test * fix import error in discrete unit test (for pytest) * add optional Travis test against python3.8 * remove unused (and sometimes incorrect) creation of test suites and run_all.py Co-authored-by: bnavigator <code@bnavigator.de>
This PR switches the unit testing to use
pytest
for Travis CI instead of the deprecatedsetup.py test
. It also adds an optional test for Python 3.8.