Repository navigation
CI tests via GitHub actions and conda #504
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
Changes from 4 commits
3f87c33
21e47a6
d83e67d
627754f
47251c6
6ff2e9b
5bb9de4
36ecea1
b7b696f
40aac67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| name: Conda-based pytest | ||
|
|
||
| on: [push, pull_request] | ||
|
|
||
| jobs: | ||
| build-linux: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| strategy: | ||
| max-parallel: 5 | ||
| matrix: | ||
| python-version: [2.7, 3.6, 3.9] | ||
| slycot: ["", "conda"] | ||
| array-and-matrix: [0] | ||
| include: | ||
| - python-version: 3.9 | ||
| slycot: conda | ||
| array-and-matrix: 1 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v2 | ||
| - name: Set up conda | ||
| run: | | ||
| echo $CONDA/bin >> $GITHUB_PATH | ||
| conda create -q -n test-environment python=${{matrix.python-version}} | ||
|
murrayrm marked this conversation as resolved.
Outdated
|
||
| - name: Install dependencies | ||
| run: | | ||
| source $CONDA/bin/activate test-environment | ||
| conda install pip coverage pytest | ||
| conda install numpy matplotlib scipy | ||
| if [[ '${{matrix.python-version}}' == '2.7' ]]; then | ||
| # matplotlib for Python 2.7 seems to require X11 to run correctly | ||
| sudo apt install -y xvfb | ||
| fi | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why still bother with Python2? Time to ditch it for the next release. Also, pytest-xvfb is the way to go.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the suggestion. Will try shifting to pytest-xvfb. I figure we may as well test against Python 2.7 for as long as it continues to work. Amazingly, it is still the default Python on MacOS 11 (Big Sur).
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we don't actively remove it, every PR with a failing Py2 test will try to workaround it. I think we should save contributors from this torture. |
||
| - name: Install slycot via conda (optional) | ||
| if: ${{ matrix.slycot == 'conda' }} | ||
| run: | | ||
| source $CONDA/bin/activate test-environment | ||
| conda install -c conda-forge slycot | ||
| - name: Test with pytest | ||
| env: | ||
| PYTHON_CONTROL_ARRAY_AND_MATRIX: ${{ matrix.array-and-matrix }} | ||
| run: | | ||
| source $CONDA/bin/activate test-environment | ||
| if [[ '${{matrix.python-version}}' == '2.7' ]]; then | ||
| # Run within (virtual) X11 environment for Python 2.7/matplotlib | ||
| xvfb-run pytest control/tests | ||
| else | ||
| coverage run -m pytest control/tests | ||
| fi | ||
|
murrayrm marked this conversation as resolved.
Outdated
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,8 @@ | |
| from control.statesp import StateSpace | ||
| from control.bdalg import feedback | ||
|
|
||
| from control.tests.conftest import X11only | ||
|
|
||
|
|
||
| class TestRootLocus: | ||
| """These are tests for the feedback function in rlocus.py.""" | ||
|
|
@@ -48,6 +50,7 @@ def test_without_gains(self, sys): | |
| roots, kvect = root_locus(sys, plot=False) | ||
| self.check_cl_poles(sys, roots, kvect) | ||
|
|
||
| @X11only | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The failures are not due to X11 but because the figure manager has no toolbar. I guess the matplotlib version/setup is different than on the Travis runners. Same problem has always been present for the openSUSE rpm package, which I maintain. Forcing the PyQt5 backend instead of Agg helped there, but my tries (short) for Slycot on GitHub worklfows did not succeed. I just skip the two tests in python-control/Slycot#140
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the extra info. I'd prefer not to have to factor these out. Let me see if I can use pytest-xvfb or something similar to get it to work.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I ended up leaving in these marks since they are useful if you are testing without X11, but also got pytest-xvfb working, so these tests aren't skipped in the GitHub Actions CI testing. |
||
| def test_root_locus_zoom(self): | ||
| """Check the zooming functionality of the Root locus plot""" | ||
| system = TransferFunction([1000], [1, 25, 100, 0]) | ||
|
|
||
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.
Conflicts with the conda setup
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 think I might be able to remove this completely. I meant to do that at one point but lost track of it while playing around to just get something to work. I'll see if I can remove it and if things still work correctly.