diff --git a/.github/workflows/bleeding-edge.yml b/.github/workflows/bleeding-edge.yml index 53e92b198..294c99e23 100644 --- a/.github/workflows/bleeding-edge.yml +++ b/.github/workflows/bleeding-edge.yml @@ -12,21 +12,25 @@ jobs: test-ets: strategy: matrix: - os: [ubuntu-20.04] - toolkit: ['pyside6', 'pyside2', 'wx'] + os: [ubuntu-latest] + toolkit: ['pyside6', 'pyside2'] python-version: [3.8] runs-on: ${{ matrix.os }} steps: - name: Check out - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Install PySide2 (from PyPI) dependencies for Linux run: | sudo apt-get update - sudo apt-get install qt5-default + sudo apt-get install qtbase5-dev + sudo apt-get install qtchooser + sudo apt-get install qt5-qmake + sudo apt-get install qtbase5-dev-tools + sudo apt-get install libegl1 sudo apt-get install libxkbcommon-x11-0 sudo apt-get install libxcb-icccm4 sudo apt-get install libxcb-image0 @@ -34,6 +38,7 @@ jobs: sudo apt-get install libxcb-randr0 sudo apt-get install libxcb-render-util0 sudo apt-get install libxcb-xinerama0 + sudo apt-get install libxcb-shape0 if: matrix.toolkit != 'wx' - name: Install Wx dependencies for Linux run: | @@ -62,19 +67,14 @@ jobs: - name: Run enable test suite env: PYTHONFAULTHANDLER: 1 - uses: GabrielBB/xvfb-action@v1 - with: - # kiva agg requires at least 15-bit color depth. - # The --server-args assumes xvfb-run is called, hence Linux only. - run: --server-args="-screen 0 1024x768x24" python -m unittest discover -v enable - working-directory: ${{ runner.temp }} + # kiva agg requires at least 15-bit color depth. + run: xvfb-run --server-args="-screen 0 1024x768x24" python -m unittest discover -v enable + working-directory: ${{ runner.temp }} - name: Run kiva test suite env: PYTHONFAULTHANDLER: 1 - uses: GabrielBB/xvfb-action@v1 - with: - run: python -m unittest discover -v kiva - working-directory: ${{ runner.temp }} + run: xvfb-run python -m unittest discover -v kiva + working-directory: ${{ runner.temp }} notify-on-failure: needs: test-ets diff --git a/.github/workflows/test-with-edm.yml b/.github/workflows/test-with-edm.yml index 3a02a4746..bfde540e4 100644 --- a/.github/workflows/test-with-edm.yml +++ b/.github/workflows/test-with-edm.yml @@ -7,7 +7,7 @@ name: Test with EDM on: pull_request env: - INSTALL_EDM_VERSION: 3.2.1 + INSTALL_EDM_VERSION: 3.5.0 jobs: @@ -15,18 +15,30 @@ jobs: test-edm-linux: strategy: matrix: - toolkit: ['null', 'pyqt5', 'pyside2', 'wx'] + toolkit: ['null', 'pyqt5', 'pyside2'] runtime: ['3.6'] include: - toolkit: 'pyside6' runtime: '3.8' - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install Qt dependencies for Linux run: | sudo apt-get update + sudo apt-get install qtbase5-dev + sudo apt-get install qtchooser + sudo apt-get install qt5-qmake + sudo apt-get install qtbase5-dev-tools + sudo apt-get install libegl1 sudo apt-get install libxkbcommon-x11-0 + sudo apt-get install libxcb-icccm4 + sudo apt-get install libxcb-image0 + sudo apt-get install libxcb-keysyms1 + sudo apt-get install libxcb-randr0 + sudo apt-get install libxcb-render-util0 + sudo apt-get install libxcb-xinerama0 + sudo apt-get install libxcb-shape0 if: matrix.toolkit != 'wx' - name: Install Wx dependencies for Linux run: | @@ -41,7 +53,7 @@ jobs: path: ~/.cache key: ${{ runner.os }}-${{ matrix.toolkit }}-${{ matrix.runtime }}-${{ hashFiles('ci/edmtool.py') }} - name: Setup EDM - uses: enthought/setup-edm-action@v1 + uses: enthought/setup-edm-action@v2 with: edm-version: ${{ env.INSTALL_EDM_VERSION }} - name: Install click to the default EDM environment @@ -49,11 +61,8 @@ jobs: - name: Install test environment run: edm run -- python ci/edmtool.py install --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }} - name: Run tests - uses: GabrielBB/xvfb-action@v1 - with: - # kiva agg requires at least 15-bit color depth. - # The --server-args assumes xvfb-run is called, hence Linux only. - run: --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }} + # kiva agg requires at least 15-bit color depth. + run: xvfb-run --server-args="-screen 0 1024x768x24" edm run -- python ci/edmtool.py test --toolkit=${{ matrix.toolkit }} --runtime=${{ matrix.runtime }} # Test against EDM packages on Windows and OSX test-with-edm: diff --git a/ci/.edm.yaml b/ci/.edm.yaml index 35a5b7af7..9773a5cba 100644 --- a/ci/.edm.yaml +++ b/ci/.edm.yaml @@ -1,3 +1,4 @@ store_url: https://packages.enthought.com repositories: - enthought/free + - enthought/lgpl diff --git a/ci/edmtool.py b/ci/edmtool.py index 2aa921e9c..ceff9c4d3 100644 --- a/ci/edmtool.py +++ b/ci/edmtool.py @@ -210,7 +210,7 @@ def install(runtime, toolkit, environment, source): elif sys.platform == "linux": # XXX this is mainly for TravisCI workers; need a generic solution commands.append( - "edm run -e {environment} -- pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/ wxPython<4.1" # noqa: E501 + "edm run -e {environment} -- pip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-22.04/ wxPython" # noqa: E501 ) else: commands.append( diff --git a/ci/requirements_3.6.txt b/ci/requirements_3.6.txt index a13329680..9ddfdc157 100644 --- a/ci/requirements_3.6.txt +++ b/ci/requirements_3.6.txt @@ -1,2 +1,2 @@ pygarrayimage -pyglet +pyglet<2.0 diff --git a/ci/requirements_3.8.txt b/ci/requirements_3.8.txt index da8f00268..bde71b04e 100644 --- a/ci/requirements_3.8.txt +++ b/ci/requirements_3.8.txt @@ -1,4 +1,4 @@ pygarrayimage -pyglet -pypdf2 +pyglet<2.0 +pypdf2<3.0 reportlab diff --git a/enable/__init__.py b/enable/__init__.py index 2a8ad63a5..8ec8cd4d4 100644 --- a/enable/__init__.py +++ b/enable/__init__.py @@ -25,7 +25,7 @@ # Dependencies for running enable/kiva's examples "examples": ["chaco", "mayavi", "scipy", "kiwisolver", "pyglet"], # Dependencies for GL backend support - "gl": ["pygarrayimage", "pyglet"], + "gl": ["pygarrayimage", "pyglet<2.0"], # Dependencies for constrained layout "layout": ["kiwisolver"], # Dependencies for PDF backend @@ -34,7 +34,7 @@ "svg": ["pyparsing"], # Dependencies purely for running tests. "test": [ - "PyPDF2", # for pdf drawing tests in kiva. + "PyPDF2<3.0", # for pdf drawing tests in kiva. "setuptools", ], } diff --git a/enable/savage/svg/tests/test_document.py b/enable/savage/svg/tests/test_document.py index 92b64e523..6e9259e06 100644 --- a/enable/savage/svg/tests/test_document.py +++ b/enable/savage/svg/tests/test_document.py @@ -8,8 +8,9 @@ # # Thanks for using Enthought open source! -from io import StringIO +from io import BytesIO, StringIO import unittest +from unittest.mock import patch import xml.etree.cElementTree as etree import enable.savage.svg.document as document @@ -62,8 +63,10 @@ def testOpacityClampLow(self): self.document.state["fill-opacity"] = -100 self.assertEqual(self.document.getBrushFromState().color[-1], 0) - def testURLFallback(self): - self.document.state["fill"] = "url(http://google.com) red" + @patch('urllib.request.urlopen') + def testURLFallback(self, mock_urlopen): + mock_urlopen.return_value = BytesIO(b"") + self.document.state["fill"] = "url(http://example.com) red" self.assertEqual( self.document.getBrushFromState().color, (255, 0, 0, 255) ) diff --git a/kiva/agg/tests/test_affine_matrix.py b/kiva/agg/tests/test_affine_matrix.py index 21ee2fb4a..b88dd8c76 100644 --- a/kiva/agg/tests/test_affine_matrix.py +++ b/kiva/agg/tests/test_affine_matrix.py @@ -10,7 +10,7 @@ from math import pi import unittest -from numpy import array, allclose, ones, alltrue +from numpy import array, allclose, ones, all from kiva import agg @@ -24,7 +24,7 @@ def test_init_from_array(self): m = agg.AffineMatrix(a) desired = ones(6, "d") result = m.asarray() - assert alltrue(result == desired) + assert all(result == desired) def test_init_from_array1(self): a = ones(6, "D") @@ -53,19 +53,19 @@ def test_imul(self): a *= a actual = a desired = agg.AffineMatrix((4.0, 0, 0, 4.0, 0, 0)) - assert alltrue(desired == actual) + assert all(desired == actual) def test_asarray(self): m = agg.AffineMatrix() result = m.asarray() desired = array((1.0, 0.0, 0.0, 1.0, 0.0, 0.0)) - assert alltrue(result == desired) + assert all(result == desired) def _test_zero_arg_transform(self, method, orig, desired): m = agg.AffineMatrix(orig) method(m) result = m.asarray() - assert alltrue(result == desired) + assert all(result == desired) def test_flip_x(self): method = agg.AffineMatrix.flip_x @@ -92,14 +92,14 @@ def test_multiply(self): other = agg.AffineMatrix(orig) m.multiply(other) result = m.asarray() - assert alltrue(result == desired) + assert all(result == desired) def test_determinant(self): orig = array((1.0, 2.0, 3.0, 1.0, 4.0, 5.0)) desired = -5.0 m = agg.AffineMatrix(orig) result = m.determinant() - assert alltrue(result == desired) + assert all(result == desired) def test_invert(self): orig = agg.AffineMatrix((1.0, 2.0, 3.0, 1.0, 4.0, 5.0)) diff --git a/kiva/agg/tests/test_utils.py b/kiva/agg/tests/test_utils.py index 201a6d276..16914ce18 100644 --- a/kiva/agg/tests/test_utils.py +++ b/kiva/agg/tests/test_utils.py @@ -7,11 +7,11 @@ # is also available online at http://www.enthought.com/licenses/BSD.txt # # Thanks for using Enthought open source! -from numpy import alltrue, ravel +from numpy import all, ravel class Utils(object): def assertRavelEqual(self, x, y): self.assertTrue( - alltrue(ravel(x) == ravel(y)), "\n%s\n !=\n%s" % (x, y) + all(ravel(x) == ravel(y)), "\n%s\n !=\n%s" % (x, y) ) diff --git a/kiva/basecore2d.py b/kiva/basecore2d.py index 117abf11a..bc59ee724 100644 --- a/kiva/basecore2d.py +++ b/kiva/basecore2d.py @@ -29,7 +29,7 @@ """ import numpy as np -from numpy import alltrue, array, asarray, float64, pi +from numpy import all, array, asarray, float64, pi from .constants import ( CAP_BUTT, CAP_ROUND, CAP_SQUARE, CLOSE, CONCAT_CTM, EOF_FILL_STROKE, @@ -73,7 +73,7 @@ def is_fully_transparent(color): def fill_equal(fill1, fill2): """ Compares the two fill colors. """ - return alltrue(fill1 == fill2) + return all(fill1 == fill2) class GraphicsContextBase(AbstractGraphicsContext): @@ -353,7 +353,7 @@ def set_line_dash(self, pattern, phase=0): to start. phase defaults to 0. """ - if not alltrue(pattern): + if not all(pattern): self.state.line_state.line_dash = NO_DASH return pattern = asarray(pattern) diff --git a/kiva/line_state.py b/kiva/line_state.py index f865f0fc1..c51e49ba6 100644 --- a/kiva/line_state.py +++ b/kiva/line_state.py @@ -14,13 +14,13 @@ state (eg. Wx, SVG and PDF backends, but not Agg or QPainter). """ -from numpy import alltrue, array, asarray, shape, sometrue +from numpy import all, array, asarray, shape, sometrue from .constants import NO_DASH def exactly_equal(arr1, arr2): - return shape(arr1) == shape(arr2) and alltrue(arr1 == arr2) + return shape(arr1) == shape(arr2) and all(arr1 == arr2) def is_dashed(dash): diff --git a/kiva/tests/agg/test_image.py b/kiva/tests/agg/test_image.py index 936cc9eb7..f1e504ab2 100644 --- a/kiva/tests/agg/test_image.py +++ b/kiva/tests/agg/test_image.py @@ -13,7 +13,7 @@ import unittest from numpy import ( - alltrue, array, concatenate, dtype, frombuffer, newaxis, ones, pi, ravel, + all, array, concatenate, dtype, frombuffer, newaxis, ones, pi, ravel, zeros, ) from PIL import Image @@ -76,7 +76,7 @@ def alpha_blend(src1, src2, alpha=1.0, ambient_alpha=1.0): def assert_equal(desired, actual): """ Only use for small arrays. """ try: - assert alltrue(ravel(actual) == ravel(desired)) + assert all(ravel(actual) == ravel(desired)) except AssertionError: size = sum(array(desired.shape)) if size < 10: @@ -97,7 +97,7 @@ def assert_close(desired, actual, diff_allowed=2): try: # cast up so math doesn't underflow diff = abs(ravel(actual.astype(Int32)) - ravel(desired.astype(Int32))) - assert alltrue(diff <= diff_allowed) + assert all(diff <= diff_allowed) except AssertionError: size = sum(array(desired.shape)) if size < 10: diff --git a/kiva/tests/test_affine.py b/kiva/tests/test_affine.py index 0d40e3bb2..5e1627ab0 100644 --- a/kiva/tests/test_affine.py +++ b/kiva/tests/test_affine.py @@ -19,7 +19,7 @@ """ import unittest -from numpy import allclose, alltrue, array, cos, dot, identity, pi, ravel +from numpy import allclose, all, array, cos, dot, identity, pi, ravel from kiva import affine @@ -33,21 +33,21 @@ def test_from_values(self): a, b, c, d, tx, ty = 1, 2, 3, 4, 5, 6 mat = affine.affine_from_values(a, b, c, d, tx, ty) desired = array([[a, b, 0], [c, d, 0], [tx, ty, 1]]) - assert alltrue(ravel(mat) == ravel(desired)) + assert all(ravel(mat) == ravel(desired)) def test_from_scale(self): transform = affine.affine_from_scale(5.0, 6.0) pt1 = array([1.0, 1.0, 1.0]) actual = dot(pt1, transform) desired = pt1 * array((5.0, 6.0, 1.0)) - assert alltrue(actual == desired) + assert all(actual == desired) def test_from_translation(self): transform = affine.affine_from_translation(5.0, 6.0) pt1 = array([1.0, 1.0, 1.0]) actual = dot(pt1, transform) desired = pt1 + array((5.0, 6.0, 0.0)) - assert alltrue(actual == desired) + assert all(actual == desired) def test_from_rotation(self): transform = affine.affine_from_rotation(pi / 4.0) @@ -55,7 +55,7 @@ def test_from_rotation(self): actual = dot(pt1, transform) cos_pi_4 = cos(pi / 4.0) desired = array((cos_pi_4, cos_pi_4, 1.0)) - assert alltrue((actual - desired) < 1e-6) + assert all((actual - desired) < 1e-6) class AffineOperationsTestCase(unittest.TestCase): @@ -73,7 +73,7 @@ def test_scale(self): actual = dot(pt1, transform2) # this does the first transform and the scaling separately desired = dot(pt1, transform1) * array((0.5, 1.5, 1.0)) - assert alltrue((actual - desired) < 1e-6) + assert all((actual - desired) < 1e-6) def test_translate(self): a, b, c, d, tx, ty = 1, 2, 3, 4, 5, 6 @@ -84,7 +84,7 @@ def test_translate(self): actual = dot(pt1, tot_transform) # this does the first transform and the translate separately desired = dot(dot(pt1, translate_transform), transform1) - assert alltrue((actual - desired) < 1e-6) + assert all((actual - desired) < 1e-6) def test_rotate(self): a, b, c, d, tx, ty = 1.0, 0, 0, 1.0, 0, 0 @@ -95,7 +95,7 @@ def test_rotate(self): # this does the first transform and the translate separately cos_pi_4 = 0.707_106_781_186_547_57 desired = array((cos_pi_4, cos_pi_4, 1.0)) - assert alltrue((actual - desired) < 1e-6) + assert all((actual - desired) < 1e-6) def test_invert(self): """ An matrix times its inverse should produce the identity matrix @@ -105,7 +105,7 @@ def test_invert(self): transform2 = affine.invert(transform1) desired = affine.affine_identity() actual = dot(transform2, transform1) - assert alltrue((ravel(actual) - ravel(desired)) < 1e-6) + assert all((ravel(actual) - ravel(desired)) < 1e-6) def test_concat(self): a, b, c, d, tx, ty = 1, 2, 3, 4, 5, 6 @@ -117,7 +117,7 @@ def test_concat(self): actual = dot(pt1, tot_transform) # this does the first transform and the scaling separately desired = dot(dot(pt1, transform2), transform1) - assert alltrue((actual - desired) < 1e-6) + assert all((actual - desired) < 1e-6) class AffineInformationTestCase(unittest.TestCase): @@ -169,7 +169,7 @@ def test_transform_point(self): ctm = affine.affine_identity() ctm = affine.translate(ctm, 5, 5) new_pt = affine.transform_point(ctm, pt) - assert alltrue(new_pt == array((6, 6))) + assert all(new_pt == array((6, 6))) ctm = affine.rotate(ctm, pi) new_pt = affine.transform_point(ctm, pt) @@ -185,7 +185,7 @@ def test_transform_points(self): ctm = affine.affine_identity() ctm = affine.translate(ctm, 5, 5) new_pt = affine.transform_points(ctm, pt) - assert alltrue(new_pt[0] == array((6, 6))) + assert all(new_pt[0] == array((6, 6))) ctm = affine.rotate(ctm, pi) new_pt = affine.transform_points(ctm, pt) diff --git a/kiva/tests/test_basecore2d.py b/kiva/tests/test_basecore2d.py index 2792ce2ea..2d42589a8 100644 --- a/kiva/tests/test_basecore2d.py +++ b/kiva/tests/test_basecore2d.py @@ -19,7 +19,7 @@ import unittest -from numpy import alltrue, array, ravel +from numpy import all, array, ravel from kiva import affine from kiva import basecore2d @@ -111,7 +111,7 @@ def test_get_ctm(self): # default ctm should be identity matrix. desired = affine.affine_identity() actual = gc.get_ctm() - self.assertTrue(alltrue(ravel(actual == desired))) + self.assertTrue(all(ravel(actual == desired))) def test_scale_ctm(self): gc = basecore2d.GraphicsContextBase() @@ -120,7 +120,7 @@ def test_scale_ctm(self): desired = affine.scale(ident, sx, sy) gc.scale_ctm(sx, sy) actual = gc.get_ctm() - self.assertTrue(alltrue(ravel(actual == desired))) + self.assertTrue(all(ravel(actual == desired))) def test_rotate_ctm(self): gc = basecore2d.GraphicsContextBase() @@ -129,7 +129,7 @@ def test_rotate_ctm(self): desired = affine.rotate(ident, angle) gc.rotate_ctm(angle) actual = gc.get_ctm() - self.assertTrue(alltrue(ravel(actual == desired))) + self.assertTrue(all(ravel(actual == desired))) def test_translate_ctm(self): gc = basecore2d.GraphicsContextBase() @@ -138,7 +138,7 @@ def test_translate_ctm(self): desired = affine.translate(ident, x, y) gc.translate_ctm(x, y) actual = gc.get_ctm() - self.assertTrue(alltrue(ravel(actual == desired))) + self.assertTrue(all(ravel(actual == desired))) def test_concat_ctm(self): gc = basecore2d.GraphicsContextBase() @@ -147,7 +147,7 @@ def test_concat_ctm(self): desired = affine.concat(ident, trans) gc.concat_ctm(trans) actual = gc.get_ctm() - self.assertTrue(alltrue(ravel(actual == desired))) + self.assertTrue(all(ravel(actual == desired))) # ------------------------------------------------------------------------- # Setting drawing state variables @@ -236,7 +236,7 @@ def test_state_line_dash(self): self.assertTrue(gc.state.line_state.is_dashed()) self.assertEqual(gc.state.line_state.line_dash[0], 0) self.assertTrue( - alltrue( + all( ravel(gc.state.line_state.line_dash[1] == array([3.0, 4.0])) ) ) @@ -244,7 +244,7 @@ def test_state_line_dash(self): self.assertTrue(gc.state.line_state.is_dashed()) self.assertEqual(gc.state.line_state.line_dash[0], 2.0) self.assertTrue( - alltrue( + all( ravel(gc.state.line_state.line_dash[1] == array([1.0, 2.0])) ) ) @@ -280,29 +280,29 @@ def test_state_alpha(self): def test_state_fill_color(self): gc = basecore2d.GraphicsContextBase() # defaults to [0,0,0,1] - self.assertTrue(alltrue(gc.state.fill_color == array([0, 0, 0, 1]))) + self.assertTrue(all(gc.state.fill_color == array([0, 0, 0, 1]))) gc.set_fill_color((0, 1, 0, 1)) gc.save_state() gc.set_fill_color((1, 1, 1, 1)) - self.assertTrue(alltrue(gc.state.fill_color == array([1, 1, 1, 1]))) + self.assertTrue(all(gc.state.fill_color == array([1, 1, 1, 1]))) gc.restore_state() - self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) + self.assertTrue(all(gc.state.fill_color == array([0, 1, 0, 1]))) def test_state_stroke_color(self): gc = basecore2d.GraphicsContextBase() # defaults to [0,0,0,1] self.assertTrue( - alltrue(gc.state.line_state.line_color == array([0, 0, 0, 1])) + all(gc.state.line_state.line_color == array([0, 0, 0, 1])) ) gc.set_stroke_color((0, 1, 0, 1)) gc.save_state() gc.set_stroke_color((1, 1, 1, 1)) self.assertTrue( - alltrue(gc.state.line_state.line_color == array([1, 1, 1, 1])) + all(gc.state.line_state.line_color == array([1, 1, 1, 1])) ) gc.restore_state() self.assertTrue( - alltrue(gc.state.line_state.line_color == array([0, 1, 0, 1])) + all(gc.state.line_state.line_color == array([0, 1, 0, 1])) ) def test_state_character_spacing(self): @@ -349,13 +349,13 @@ def test_state_context_manager(self): self.assertEqual(gc.state.line_state.line_width, 10) gc.set_fill_color((1, 1, 1, 1)) self.assertTrue( - alltrue(gc.state.fill_color == array([1, 1, 1, 1])) + all(gc.state.fill_color == array([1, 1, 1, 1])) ) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 0) self.assertEqual(gc.state.line_state.line_width, 5) - self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) + self.assertTrue(all(gc.state.fill_color == array([0, 1, 0, 1]))) def test_state_context_manager_nested(self): gc = basecore2d.GraphicsContextBase() @@ -373,7 +373,7 @@ def test_state_context_manager_nested(self): self.assertEqual(gc.state.line_state.line_width, 10) gc.set_fill_color((1, 1, 1, 1)) self.assertTrue( - alltrue(gc.state.fill_color == array([1, 1, 1, 1])) + all(gc.state.fill_color == array([1, 1, 1, 1])) ) with gc: @@ -384,20 +384,20 @@ def test_state_context_manager_nested(self): self.assertEqual(gc.state.line_state.line_width, 2) gc.set_fill_color((1, 1, 0, 1)) self.assertTrue( - alltrue(gc.state.fill_color == array([1, 1, 0, 1])) + all(gc.state.fill_color == array([1, 1, 0, 1])) ) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 1) self.assertEqual(gc.state.line_state.line_width, 10) self.assertTrue( - alltrue(gc.state.fill_color == array([1, 1, 1, 1])) + all(gc.state.fill_color == array([1, 1, 1, 1])) ) # Verify that we're back to the earlier settings. self.assertEqual(gc.state.antialias, 0) self.assertEqual(gc.state.line_state.line_width, 5) - self.assertTrue(alltrue(gc.state.fill_color == array([0, 1, 0, 1]))) + self.assertTrue(all(gc.state.fill_color == array([0, 1, 0, 1]))) # ------------------------------------------------------------------------- # Begin/End Page diff --git a/kiva/tests/test_graphics_context.py b/kiva/tests/test_graphics_context.py index 0a0e13a08..744624ed5 100644 --- a/kiva/tests/test_graphics_context.py +++ b/kiva/tests/test_graphics_context.py @@ -10,7 +10,7 @@ import unittest from numpy import ( - alltrue, array, asarray, concatenate, dtype, newaxis, ones, ravel, zeros + all, array, asarray, concatenate, dtype, newaxis, ones, ravel, zeros ) from PIL import Image as PILImage @@ -161,7 +161,7 @@ def solid_bgra32(self, size, value=0.0, alpha=1.0): def assert_images_equal(self, desired, actual): """ Only use for small arrays. """ try: - assert alltrue(ravel(actual) == ravel(desired)) + assert all(ravel(actual) == ravel(desired)) except AssertionError: size = sum(array(desired.shape)) if size < 10: @@ -183,7 +183,7 @@ def assert_images_close(self, desired, actual, diff_allowed=2): diff = abs( ravel(actual.astype(Int32)) - ravel(desired.astype(Int32)) ) - assert alltrue(diff <= diff_allowed) + assert all(diff <= diff_allowed) except AssertionError: size = sum(array(desired.shape)) if size < 10: diff --git a/pyproject.toml b/pyproject.toml index 54d49e451..7e84b62f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["cython", "oldest-supported-numpy", "setuptools", "swig", "wheel"] +requires = ["cython", "oldest-supported-numpy", "setuptools<65.2", "swig", "wheel"] build-backend = "setuptools.build_meta"