Skip to content

Commit 7d6fdd8

Browse files
committed
Use pytest-xvfb in conda and enforce QtAgg only in one run
1 parent 84640c7 commit 7d6fdd8

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

.github/conda-env/test-env.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ dependencies:
66
- pytest
77
- pytest-cov
88
- pytest-timeout
9+
- pytest-xvfb
910
- numpy
1011
- matplotlib
1112
- scipy

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ jobs:
1313
path: python-control
1414
- name: Set up Python
1515
uses: actions/setup-python@v2
16-
- name: Install Python dependencies
17-
run: |
18-
# Set up (virtual) X11
19-
sudo apt-get -y install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
20-
21-
# Install python-control with dependencies including test tools
22-
pip install -v -e './python-control[test]'
16+
- name: Install Python dependencies and test tools
17+
run: pip install -v -e './python-control[test]'
2318

2419
- name: Checkout Slycot
2520
uses: actions/checkout@v3
@@ -43,4 +38,4 @@ jobs:
4338
4439
- name: Test with pytest
4540
working-directory: python-control
46-
run: xvfb-run pytest control/tests
41+
run: pytest -v control/tests

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
${{ matrix.pandas || 'no' }} Pandas;
1111
${{ matrix.cvxopt || 'no' }} CVXOPT
1212
${{ matrix.array-and-matrix == 1 && '; array and matrix' || '' }}
13+
${{ matrix.mplbackend && format('; {0}', matrix.mplbackend) }}
1314
runs-on: ubuntu-latest
1415

1516
strategy:
@@ -20,20 +21,19 @@ jobs:
2021
slycot: ["", "conda"]
2122
pandas: [""]
2223
cvxopt: ["", "conda"]
24+
mplbackend: [""]
2325
array-and-matrix: [0]
2426
include:
2527
- python-version: '3.10'
2628
slycot: conda
2729
pandas: conda
2830
cvxopt: conda
31+
mplbackend: QtAgg
2932
array-and-matrix: 1
3033

3134
steps:
3235
- uses: actions/checkout@v3
3336

34-
- name: Set up (virtual) X11
35-
run: sudo apt-get -y install libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils
36-
3737
- name: Setup Conda
3838
uses: conda-incubator/setup-miniconda@v2
3939
with:
@@ -64,7 +64,8 @@ jobs:
6464
shell: bash -l {0}
6565
env:
6666
PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }}
67-
run: xvfb-run pytest --cov=control --cov-config=.coveragerc control/tests
67+
MPLBACKEND: ${{ matrix.mplbackend }}
68+
run: pytest -v --cov=control --cov-config=.coveragerc control/tests
6869

6970
- name: Coveralls parallel
7071
# https://github.com/coverallsapp/github-action

control/tests/rlocus_test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def test_root_locus_neg_false_gain_nonproper(self):
8585

8686
# TODO: cover and validate negative false_gain branch in _default_gains()
8787

88+
@pytest.mark.skipif(plt.get_current_fig_manager().toolbar is None,
89+
reason="Requires the zoom toolbar")
8890
def test_root_locus_zoom(self):
8991
"""Check the zooming functionality of the Root locus plot"""
9092
system = TransferFunction([1000], [1, 25, 100, 0])

control/tests/sisotool_test.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def sys221(self):
4646
D221 = [[1., -1.]]
4747
return StateSpace(A222, B222, C221, D221)
4848

49+
@pytest.mark.skipif(plt.get_current_fig_manager().toolbar is None,
50+
reason="Requires the zoom toolbar")
4951
def test_sisotool(self, tsys):
5052
sisotool(tsys, Hz=False)
5153
fig = plt.gcf()
@@ -114,6 +116,8 @@ def test_sisotool(self, tsys):
114116
assert_array_almost_equal(
115117
ax_step.lines[0].get_data()[1][:10], step_response_moved, 4)
116118

119+
@pytest.mark.skipif(plt.get_current_fig_manager().toolbar is None,
120+
reason="Requires the zoom toolbar")
117121
@pytest.mark.parametrize('tsys', [0, True],
118122
indirect=True, ids=['ctime', 'dtime'])
119123
def test_sisotool_tvect(self, tsys):

0 commit comments

Comments
 (0)