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

Commit0320595

Browse files
authored
Merge pull request#537 from bnavigator/pytest-timeout
Use pytest-timeout for rlocus test
2 parents3adc610 +25114f5 commit0320595

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

‎.github/workflows/control-slycot-src.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
sudo apt install -y xvfb
2020
2121
# Install test tools
22-
conda install pip pytest
22+
conda install pip pytest pytest-timeout
2323
2424
# Install python-control dependencies
2525
conda install numpy matplotlib scipy

‎.github/workflows/python-package-conda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
sudo apt install -y xvfb
3333
3434
# Install test tools
35-
conda install pip coverage pytest
35+
conda install pip coverage pytest pytest-timeout
3636
pip install coveralls
3737
3838
# Install python-control dependencies

‎control/tests/rlocus_test.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def test_root_locus_zoom(self):
7676
assert_array_almost_equal(zoom_x,zoom_x_valid)
7777
assert_array_almost_equal(zoom_y,zoom_y_valid)
7878

79+
@pytest.mark.timeout(2)
7980
deftest_rlocus_default_wn(self):
8081
"""Check that default wn calculation works properly"""
8182
#
@@ -94,12 +95,5 @@ def test_rlocus_default_wn(self):
9495
sys=ct.tf(*sp.signal.zpk2tf(
9596
[-1e-2,1-1e7j,1+1e7j], [0,-1e7j,1e7j],1))
9697

97-
# Set up a timer to catch execution time
98-
defsignal_handler(signum,frame):
99-
raiseException("rlocus took too long to complete")
100-
signal.signal(signal.SIGALRM,signal_handler)
101-
102-
# Run the command and reset the alarm
103-
signal.alarm(2)# 2 second timeout
10498
ct.root_locus(sys)
105-
signal.alarm(0)# reset the alarm
99+

‎setup.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@
4444
install_requires=['numpy',
4545
'scipy',
4646
'matplotlib'],
47+
extras_require={
48+
'test': ['pytest','pytest-timeout'],
49+
}
4750
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp