Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
12 commits
Select commitHold shift + click to select a range
a70583b
switch Travis to use pytest instead of deprecated setup.py test
murrayrmJan 20, 2020
989326d
fix import error in discrete unit test (for pytest)
murrayrmJan 20, 2020
e4e490c
install pytest for Travis CI
murrayrmJan 20, 2020
ed8a27b
update Travis pytest to ignore slycot
murrayrmJan 20, 2020
64adf46
update Travis pytest to ignore slycot, attempt 2
murrayrmJan 20, 2020
866e9ee
add optional Travis test against python3.8
murrayrmJan 20, 2020
e25e8b2
add python3.8 testing
murrayrmJan 20, 2020
263735a
trim python3.8 testing to a single case (for now)
murrayrmJan 20, 2020
53202aa
remove matrix keyword in travis
bnavigatorMar 18, 2020
c2ade6f
remove unneeded initialization code that was causing problems with py…
murrayrmMar 22, 2020
1881f9d
fix small typo in test file (probably irrelevent)
murrayrmMar 22, 2020
aed449d
remove unused (and sometimes incorrect) creation of test suites and r…
murrayrmMar 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions.travis.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ env:
- SCIPY=scipy SLYCOT= # default, w/out slycot
- SCIPY="scipy==0.19.1" SLYCOT= # legacy support, w/out slycot

# Add optional builds that test against latest version of slycot
# Add optional builds that test against latest version of slycot, python
jobs:
include:
- name: "linux, Python 2.7, slycot=source"
Expand All@@ -43,8 +43,13 @@ jobs:
services: xvfb
python: "3.7"
env: SCIPY=scipy SLYCOT=source
- name: "linux, Python 3.8, slycot=source"
os: linux
dist: xenial
services: xvfb
python: "3.8"
env: SCIPY=scipy SLYCOT=source

matrix:
# Exclude combinations that are very unlikely (and don't work)
exclude:
- python: "3.7" # python3.7 should use latest scipy
Expand All@@ -63,6 +68,12 @@ matrix:
services: xvfb
python: "3.7"
env: SCIPY=scipy SLYCOT=source
- name: "linux, Python 3.8, slycot=source"
os: linux
dist: xenial
services: xvfb
python: "3.8"
env: SCIPY=scipy SLYCOT=source

# install required system libraries
before_install:
Expand DownExpand Up@@ -97,6 +108,7 @@ before_install:
fi
# Make sure to look in the right place for python libraries (for slycot)
- export LIBRARY_PATH="$HOME/miniconda/envs/test-environment/lib"
- conda install pytest
# coveralls not in conda repos => install via pip instead
- pip install coveralls

Expand All@@ -118,7 +130,7 @@ install:
# command to run tests
script:
- 'if [ $SLYCOT != "" ]; then python -c "import slycot"; fi'
- coverage runsetup.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
MemberAuthor

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 ofnumpy.matrix, which I figure we will get rid of starting in v0.9.0.


# only run examples if Slycot is install
# set PYTHONPATH for examples
Expand Down
6 changes: 0 additions & 6 deletionscontrol/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -79,11 +79,5 @@
except ImportError:
__version__ = "dev"

# The following is to use Numpy's testing framework
# Tests go under directory tests/, benchmarks under directory benchmarks/
from numpy.testing import Tester
test = Tester().test
bench = Tester().bench

# Initialize default parameter values
reset_defaults()
6 changes: 1 addition & 5 deletionscontrol/tests/bdalg_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# bdalg_test.py - testsuit for block diagram algebra
# bdalg_test.py - testsuite for block diagram algebra
# RMM, 30 Mar 2011 (based on TestBDAlg from v0.4a)

import unittest
Expand DownExpand Up@@ -271,9 +271,5 @@ def test_feedback_args(self):
self.assertTrue(isinstance(sys, ctrl.FRD))


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestFeedback)


if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/canonical_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -288,9 +288,6 @@ def test_similarity(self):
np.testing.assert_array_almost_equal(mimo_new.C, mimo_ini.C)
np.testing.assert_array_almost_equal(mimo_new.D, mimo_ini.D)

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestFeedback)


if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/config_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -218,9 +218,6 @@ def tearDown(self):
# Reset the configuration defaults
ct.config.reset_defaults()

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestTimeresp)


if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletionscontrol/tests/convert_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -268,8 +268,6 @@ def test_tf2ss_robustness(self):
np.testing.assert_array_almost_equal(np.sort(sys2tf.pole()),
np.sort(sys2ss.pole()))

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestConvert)

if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/ctrlutil_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -58,8 +58,5 @@ def test_mag2db_array(self):
np.testing.assert_array_almost_equal(db_array, self.db)


def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(TestUtils)

if __name__ == "__main__":
unittest.main()
7 changes: 3 additions & 4 deletionscontrol/tests/discrete_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,7 +5,9 @@

import unittest
import numpy as np
from control import *
from control import StateSpace, TransferFunction, feedback, step_response, \
isdtime, timebase, isctime, sample_system, bode, impulse_response, \
timebaseEqual, forced_response
from control import matlab

class TestDiscrete(unittest.TestCase):
Expand DownExpand Up@@ -382,9 +384,6 @@ def test_discrete_bode(self):
np.testing.assert_array_almost_equal(mag_out, np.absolute(H_z))
np.testing.assert_array_almost_equal(phase_out, np.angle(H_z))

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestDiscrete)


if __name__ == "__main__":
unittest.main()
4 changes: 0 additions & 4 deletionscontrol/tests/flatsys_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -127,9 +127,5 @@ def tearDown(self):
ct.reset_defaults()


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestFlatSys)


if __name__ == '__main__':
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/frd_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -415,8 +415,5 @@ def test_evalfr_deprecated(self):
self.assertRaises(PendingDeprecationWarning, frd_tf.evalfr, 1.)


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestFRD)

if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/freqresp_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -235,8 +235,5 @@ def test_options(self):
ctrl.config.reset_defaults()


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestTimeresp)

if __name__ == '__main__':
unittest.main()
4 changes: 0 additions & 4 deletionscontrol/tests/iosys_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -911,10 +911,6 @@ def test_duplicates(self):
self.assertEqual(len(warnval), 0)


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestTimeresp)


# Predator prey dynamics
def predprey(t, x, u, params={}):
r = params.get('r', 2)
Expand Down
2 changes: 0 additions & 2 deletionscontrol/tests/lti_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -70,8 +70,6 @@ def test_dcgain(self):
np.testing.assert_equal(sys.dcgain(), 42)
np.testing.assert_equal(dcgain(sys), 42)

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestUtils)

if __name__ == "__main__":
unittest.main()
4 changes: 1 addition & 3 deletionscontrol/tests/margin_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# margin_test.py - testsuit for stability margin commands
# margin_test.py - testsuite for stability margin commands
# RMM, 15 Jul 2011

from __future__ import print_function
Expand DownExpand Up@@ -310,8 +310,6 @@ def test_zmore_margin(self):
assert_array_almost_equal(
res, test['result'], test['digits'])

def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(TestMargin)

if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/mateqn_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -299,8 +299,5 @@ def test_raise(self):
assert_raises(ControlArgument, cdare, A, B, Q, R, S)


def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestMatrixEquations)

if __name__ == "__main__":
unittest.main()
2 changes: 0 additions & 2 deletionscontrol/tests/matlab_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -688,8 +688,6 @@ def test_tf_string_args(self):
# for i in range(len(tfdata)):
# np.testing.assert_array_almost_equal(tfdata_1[i], tfdata_2[i])

def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(TestMatlab)

if __name__ == '__main__':
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/minreal_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -108,9 +108,6 @@ def testMinrealtf(self):
np.testing.assert_array_almost_equal(hm.num[0][0], hr.num[0][0])
np.testing.assert_array_almost_equal(hm.den[0][0], hr.den[0][0])

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestMinreal)


if __name__ == "__main__":
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/modelsimp_array_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -169,9 +169,6 @@ def tearDown(self):
# Reset configuration variables to their original settings
control.config.reset_defaults()

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestModelsimp)


if __name__ == '__main__':
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/modelsimp_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -130,9 +130,6 @@ def testBalredMatchDC(self):
np.testing.assert_array_almost_equal(rsys.C, Crtrue,decimal=4)
np.testing.assert_array_almost_equal(rsys.D, Drtrue,decimal=4)

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestModelsimp)


if __name__ == '__main__':
unittest.main()
3 changes: 0 additions & 3 deletionscontrol/tests/nichols_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,9 +29,6 @@ def testNgrid(self):
nichols(self.sys, grid=False)
ngrid()

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestStateSpace)


if __name__ == "__main__":
unittest.main()
2 changes: 0 additions & 2 deletionscontrol/tests/phaseplot_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -77,8 +77,6 @@ def invpend_ode(self, x, t, m=1., l=1., b=0, g=9.8):
def oscillator_ode(self, x, t, m=1., b=1, k=1, extra=None):
return (x[1], -k/m*x[0] - b/m*x[1])

def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestPhasePlot)

if __name__ == '__main__':
unittest.main()
2 changes: 0 additions & 2 deletionscontrol/tests/rlocus_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -68,8 +68,6 @@ def test_root_locus_zoom(self):
assert_array_almost_equal(zoom_x,zoom_x_valid)
assert_array_almost_equal(zoom_y,zoom_y_valid)

def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(TestRootLocus)

if __name__ == "__main__":
unittest.main()
1 change: 1 addition & 0 deletionscontrol/tests/robust_array_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -388,5 +388,6 @@ def testSiso(self):
def tearDown(self):
control.config.reset_defaults()


if __name__ == "__main__":
unittest.main()
71 changes: 0 additions & 71 deletionscontrol/tests/run_all.py
View file
Open in desktop

This file was deleted.

2 changes: 0 additions & 2 deletionscontrol/tests/sisotool_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -62,8 +62,6 @@ def test_sisotool(self):
step_response_moved = np.array([[ 0., 0.02458187, 0.16529784 , 0.46602716 , 0.91012035 , 1.43364313, 1.93996334 , 2.3190105 , 2.47041552 , 2.32724853] ])
assert_array_almost_equal(ax_step.lines[0].get_data()[1][:10],step_response_moved)

def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(TestSisotool)

if __name__ == "__main__":
unittest.main()
4 changes: 0 additions & 4 deletionscontrol/tests/slycot_convert_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -192,10 +192,6 @@ def testFreqResp(self):
decimal=2)


# These are here for once the above is made into a unittest.
def suite():
return unittest.TestLoader().loadTestsFromTestCase(TestSlycot)

if __name__ == '__main__':
unittest.main()

6 changes: 0 additions & 6 deletionscontrol/tests/statefbk_array_test.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -409,11 +409,5 @@ def tearDown(self):
reset_defaults()


def test_suite():

status1 = unittest.TestLoader().loadTestsFromTestCase(TestStatefbk)
status2 = unittest.TestLoader().loadTestsFromTestCase(TestStatefbk)
return status1 and status2

if __name__ == '__main__':
unittest.main()
Loading

[8]ページ先頭

©2009-2025 Movatter.jp