From 6a65cfa61ee503dd64643a8b5828712c529e7afb Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 12 Dec 2022 11:39:52 +0000 Subject: [PATCH 1/3] fix: make test suite run doctests --- test/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.py b/test/test.py index 88f781be..3f0d7418 100644 --- a/test/test.py +++ b/test/test.py @@ -447,7 +447,7 @@ def test_arb(): sys.stdout.write("test_nmod_mat..."); test_nmod_mat(); print("OK") sys.stdout.write("test_arb.."); test_arb(); print("OK") sys.stdout.write("doctests..."); - fail, total = doctest.testmod(flint); + fail, total = doctest.testmod(flint._flint); if fail == 0: print("OK") else: From cc35a5327ad421c90fa3bfcdc35b0edc175096f9 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Mon, 12 Dec 2022 22:18:34 +0000 Subject: [PATCH 2/3] test: fix doctests after Arb printing changes --- src/flint/acb_mat.pyx | 2 +- src/flint/arb_mat.pyx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/flint/acb_mat.pyx b/src/flint/acb_mat.pyx index 6a88fd6d..ceacaf4d 100644 --- a/src/flint/acb_mat.pyx +++ b/src/flint/acb_mat.pyx @@ -666,7 +666,7 @@ cdef class acb_mat(flint_mat): >>> sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True)) nan + nanj >>> showgood(lambda: sum(acb_mat(arb_mat.hilbert(20,20)).eig(nonstop=True)), parts=False) - 2.47967321036454 + [+/- 1.48e-56]j + 2.47967321036454 + 0e-55j With default options, the method only succeeds if all eigenvalues can be isolated. Multiple (overlapping) eigenvalues can be handled by diff --git a/src/flint/arb_mat.pyx b/src/flint/arb_mat.pyx index a613d87a..b571ca63 100644 --- a/src/flint/arb_mat.pyx +++ b/src/flint/arb_mat.pyx @@ -616,10 +616,10 @@ cdef class arb_mat(flint_mat): magnitude have been replaced by exact zeros. >>> print(arb_mat.stirling(4, 4).inv().str(5, radius=False)) - [1.0000, 0, 0, 0] - [ 0, 1.0000, [+/- 1.20e-15], [+/- 5.00e-16]] - [ 0, -1.0000, 1.0000, [+/- 1.67e-16]] - [ 0, 1.0000, -3.0000, 1.0000] + [1.0000, 0, 0, 0] + [ 0, 1.0000, 0e-14, 0e-15] + [ 0, -1.0000, 1.0000, 0e-15] + [ 0, 1.0000, -3.0000, 1.0000] >>> print(arb_mat.stirling(4, 4).inv().chop(1e-6).str(5, radius=False)) [1.0000, 0, 0, 0] [ 0, 1.0000, 0, 0] From e67a8e0057427317fa10b3bb7063c6dc53d69d59 Mon Sep 17 00:00:00 2001 From: Oscar Benjamin Date: Tue, 13 Dec 2022 13:21:39 +0000 Subject: [PATCH 3/3] test: add doctests in separate CI job --- .github/workflows/buildwheel.yml | 22 ++++++++++++++++++++++ bin/build_dependencies_unix.sh | 7 +++++++ test/dtest.py | 10 ++++++++++ test/test.py | 17 +++++++++++------ 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 test/dtest.py diff --git a/.github/workflows/buildwheel.yml b/.github/workflows/buildwheel.yml index 108c2ff8..a7d62cda 100644 --- a/.github/workflows/buildwheel.yml +++ b/.github/workflows/buildwheel.yml @@ -77,3 +77,25 @@ jobs: path: wheelhouse - run: pip install --find-links wheelhouse python_flint - run: python test/test.py + + doctest_wheels: + needs: build_wheels + name: Doctests for ${{ matrix.python-version }} wheel on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04, windows-2019, macos-12] + python-version: ['3.9', '3.10', '3.11'] + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - uses: actions/download-artifact@v3 + with: + name: artifact + path: wheelhouse + - run: pip install --find-links wheelhouse python_flint + - run: python test/dtest.py diff --git a/bin/build_dependencies_unix.sh b/bin/build_dependencies_unix.sh index 544599dd..62e6afdc 100755 --- a/bin/build_dependencies_unix.sh +++ b/bin/build_dependencies_unix.sh @@ -177,6 +177,13 @@ cd arb-$ARBVER --disable-static make -j3 make install + # + # Here make check passes for Linux and OSX but fails for Windows probably + # because of a linker error or something like that. It would be nice to + # enable this check when it can work for Windows but for now we disable it + # because if it fails then we don't get any wheels built. + # + # ARB_TEST_MULTIPLIER=0.1 make check cd .. # ------------------------------------------------------------------------- # diff --git a/test/dtest.py b/test/dtest.py new file mode 100644 index 00000000..754a8b90 --- /dev/null +++ b/test/dtest.py @@ -0,0 +1,10 @@ +import sys +import doctest +import flint + +sys.stdout.write("doctests..."); +fail, total = doctest.testmod(flint._flint); +if fail == 0: + print("OK") +else: + raise AssertionError("%i of %i doctests failed" % (fail, total)) diff --git a/test/test.py b/test/test.py index 3f0d7418..99126c29 100644 --- a/test/test.py +++ b/test/test.py @@ -446,9 +446,14 @@ def test_arb(): sys.stdout.write("test_nmod_poly..."); test_nmod_poly(); print("OK") sys.stdout.write("test_nmod_mat..."); test_nmod_mat(); print("OK") sys.stdout.write("test_arb.."); test_arb(); print("OK") - sys.stdout.write("doctests..."); - fail, total = doctest.testmod(flint._flint); - if fail == 0: - print("OK") - else: - raise AssertionError("%i of %i doctests failed" % (fail, total)) + print("OK") + # + # The doctests currently fail on Windows so for now we separate them into a + # separate test/doctest.py. + # + #sys.stdout.write("doctests..."); + #fail, total = doctest.testmod(flint._flint); + #if fail == 0: + # print("OK") + #else: + # raise AssertionError("%i of %i doctests failed" % (fail, total))