Skip to content

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

Merged
merged 12 commits into from
Mar 25, 2020

Conversation

murrayrm
Copy link
Member

This PR switches the unit testing to use pytest for Travis CI instead of the deprecated setup.py test. It also adds an optional test for Python 3.8.

@coveralls
Copy link

coveralls commented Mar 18, 2020

Coverage Status

Coverage increased (+0.02%) to 84.615% when pulling aed449d on murrayrm:setup-test-deprecated into 874d52e on python-control:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.599% when pulling 74e15b6 on murrayrm:setup-test-deprecated into 874d52e on python-control:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 84.599% when pulling 74e15b6 on murrayrm:setup-test-deprecated into 874d52e on python-control:master.

@murrayrm
Copy link
Member Author

For some reason the allow_failures tests are not being run. This was working when they were originally generated (several months back). Did something change in Travis CI?

Without the allow_failures functionality, the Python 3.8 test does not get run at all.

@murrayrm murrayrm force-pushed the setup-test-deprecated branch from a03ea58 to 53202aa Compare March 21, 2020 15:51
@murrayrm
Copy link
Member Author

Rebased changes on top of master to get some of the fixes from #366 the eased precision on some of the tests.

@murrayrm murrayrm added this to the 0.8.4 milestone Mar 21, 2020
@@ -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
Copy link
Contributor

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.

Copy link
Member Author

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.

Comment on lines 238 to 242
def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestTimeresp)
return unittest.TestLoader().loadTestsFromTestCase(TestFreqresp)

if __name__ == '__main__':
unittest.main()
Copy link
Contributor

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.

Copy link
Member Author

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).

@murrayrm murrayrm merged commit 6b24bb4 into python-control:master Mar 25, 2020
repagh pushed a commit to repagh/python-control that referenced this pull request Jun 9, 2020
* 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>
@murrayrm murrayrm deleted the setup-test-deprecated branch July 11, 2020 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants