From c2bebeaac8b0ae2dcb773e798825fb64ebf42452 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Tue, 6 Aug 2024 21:43:52 -0700 Subject: [PATCH 1/5] fixed incorrect unit test in nyquist_test (OS/BLAS test matrix failure --- control/tests/nyquist_test.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/control/tests/nyquist_test.py b/control/tests/nyquist_test.py index af9505354..d7cc94692 100644 --- a/control/tests/nyquist_test.py +++ b/control/tests/nyquist_test.py @@ -132,10 +132,17 @@ def test_nyquist_basic(): # Nyquist plot with poles on imaginary axis, omega specified # (can miss encirclements due to the imaginary poles at +/- 1j) sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1]) - with pytest.warns(UserWarning, match="does not match") as records: + with warnings.catch_warnings(record=True) as records: count = ct.nyquist_response(sys, np.linspace(1e-3, 1e1, 1000)) - if len(records) == 0: - assert _Z(sys) == count + _P(sys) + if len(records) == 0: + # No warnings (it happens) => make sure count is correct + assert _Z(sys) == count + _P(sys) + elif len(records) == 1: + # Expected case: make sure warning is the right one + assert issubclass(records[0].category, UserWarning) + assert "encirclements does not match" in str(records[0].message) + else: + pytest.fails("multiple warnings in nyquist_response (?)") # Nyquist plot with poles on imaginary axis, omega specified, with contour sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1]) From a377bdcff41e20df36ab26d92aff86ae659abbc9 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Tue, 6 Aug 2024 22:11:02 -0700 Subject: [PATCH 2/5] update MacOS, pip, OpenBLAS to fix path issue --- .github/workflows/os-blas-test-matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/os-blas-test-matrix.yml b/.github/workflows/os-blas-test-matrix.yml index 0e5fd25fc..7330e79c2 100644 --- a/.github/workflows/os-blas-test-matrix.yml +++ b/.github/workflows/os-blas-test-matrix.yml @@ -71,8 +71,8 @@ jobs: unset | Generic | Apple ) ;; # Found in system OpenBLAS ) brew install openblas - echo "BLAS_ROOT=/usr/local/opt/openblas/" >> $GITHUB_ENV - echo "LAPACK_ROOT=/usr/local/opt/openblas/" >> $GITHUB_ENV + echo "LDFLAGS=-L/opt/homebrew/opt/openblas/lib" >> $GITHUB_ENV + echo "CPPFLAGS=-I/opt/homebrew/opt/openblas/include" >> $GITHUB_ENV ;; *) echo "bla_vendor option ${{ matrix.bla_vendor }} not supported" From 19a8d5ca6c85d9cb2e93eb6f3e64b70cc3cc48e4 Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Wed, 7 Aug 2024 06:30:24 -0700 Subject: [PATCH 3/5] remove rendudant (and improperly implemented) Nyquist unit test --- control/tests/nyquist_test.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/control/tests/nyquist_test.py b/control/tests/nyquist_test.py index d7cc94692..e48615e03 100644 --- a/control/tests/nyquist_test.py +++ b/control/tests/nyquist_test.py @@ -144,14 +144,6 @@ def test_nyquist_basic(): else: pytest.fails("multiple warnings in nyquist_response (?)") - # Nyquist plot with poles on imaginary axis, omega specified, with contour - sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1]) - with pytest.warns(UserWarning, match="does not match") as records: - count, contour = ct.nyquist_response( - sys, np.linspace(1e-3, 1e1, 1000), return_contour=True) - if len(records) == 0: - assert _Z(sys) == count + _P(sys) - # Nyquist plot with poles on imaginary axis, return contour sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1]) count, contour = ct.nyquist_response(sys, return_contour=True) From f94b9cf52c468a763ff36102727e6606d860c34f Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Wed, 7 Aug 2024 18:30:28 -0700 Subject: [PATCH 4/5] update pip test wheel to checkout current branch, not main --- .github/workflows/os-blas-test-matrix.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/os-blas-test-matrix.yml b/.github/workflows/os-blas-test-matrix.yml index 7330e79c2..f8371e387 100644 --- a/.github/workflows/os-blas-test-matrix.yml +++ b/.github/workflows/os-blas-test-matrix.yml @@ -204,8 +204,6 @@ jobs: path: slycot-src - name: Checkout python-control uses: actions/checkout@v3 - with: - repository: 'python-control/python-control' - name: Setup Python uses: actions/setup-python@v4 with: From 25e9474187c9361fe2c156828da6bca283ae233d Mon Sep 17 00:00:00 2001 From: Richard Murray Date: Thu, 8 Aug 2024 07:25:41 -0700 Subject: [PATCH 5/5] pytest.fails -> pytest.fail in nyquist_test.py --- control/tests/nyquist_test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control/tests/nyquist_test.py b/control/tests/nyquist_test.py index e48615e03..73a4ed8b6 100644 --- a/control/tests/nyquist_test.py +++ b/control/tests/nyquist_test.py @@ -142,7 +142,7 @@ def test_nyquist_basic(): assert issubclass(records[0].category, UserWarning) assert "encirclements does not match" in str(records[0].message) else: - pytest.fails("multiple warnings in nyquist_response (?)") + pytest.fail("multiple warnings in nyquist_response (?)") # Nyquist plot with poles on imaginary axis, return contour sys = ct.tf([1], [1, 3, 2]) * ct.tf([1], [1, 0, 1])