From 600c63c17015cedc4e7c81cae32ba13749ca4cc2 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Jun 2021 00:22:40 -0500 Subject: [PATCH] Tests: adjust to use new-style actx fixture --- test/test_array.py | 8 ++++---- test/test_chained.py | 7 ++++--- test/test_connection.py | 10 ++++++---- test/test_discretization.py | 7 ++++--- test/test_firedrake_interop.py | 7 ++++--- test/test_interop.py | 10 ++++++---- test/test_mesh.py | 8 ++++---- test/test_meshmode.py | 10 +++++----- test/test_modal.py | 10 +++++----- test/test_partition.py | 9 +++++---- test/test_refinement.py | 10 ++++++---- test/test_visualization.py | 9 +++++---- 12 files changed, 58 insertions(+), 47 deletions(-) diff --git a/test/test_array.py b/test/test_array.py index 7bd69227..a3826d90 100644 --- a/test/test_array.py +++ b/test/test_array.py @@ -24,10 +24,10 @@ from dataclasses import dataclass import pytest import numpy as np -from arraycontext import _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from arraycontext import ( thaw, diff --git a/test/test_chained.py b/test/test_chained.py index 679d1ed1..6e04fd60 100644 --- a/test/test_chained.py +++ b/test/test_chained.py @@ -23,9 +23,10 @@ THE SOFTWARE. import numpy as np import pytest -from arraycontext import ( # noqa - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from arraycontext import thaw from meshmode.dof_array import flatten_to_numpy, flat_norm diff --git a/test/test_connection.py b/test/test_connection.py index fa959c0e..5afbe2ed 100644 --- a/test/test_connection.py +++ b/test/test_connection.py @@ -20,15 +20,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from arraycontext import _acf # noqa: F401 from functools import partial import numpy as np # noqa: F401 import numpy.linalg as la # noqa: F401 import meshmode # noqa: F401 -from arraycontext import ( # noqa - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) + +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) + from meshmode.mesh import SimplexElementGroup, TensorProductElementGroup from meshmode.discretization.poly_element import ( diff --git a/test/test_discretization.py b/test/test_discretization.py index f0d97567..d583f187 100644 --- a/test/test_discretization.py +++ b/test/test_discretization.py @@ -30,9 +30,10 @@ from meshmode.discretization.poly_element import ( InterpolatoryQuadratureSimplexGroupFactory, ) -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) def test_discr_nodes_caching(actx_factory): diff --git a/test/test_firedrake_interop.py b/test/test_firedrake_interop.py index c126bdb3..9b32858b 100644 --- a/test/test_firedrake_interop.py +++ b/test/test_firedrake_interop.py @@ -23,9 +23,10 @@ THE SOFTWARE. import numpy as np import pyopencl as cl -from pyopencl.tools import ( # noqa - pytest_generate_tests_for_pyopencl - as pytest_generate_tests) +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from arraycontext import PyOpenCLArrayContext diff --git a/test/test_interop.py b/test/test_interop.py index 13b1abda..2a295e0b 100644 --- a/test/test_interop.py +++ b/test/test_interop.py @@ -24,10 +24,12 @@ THE SOFTWARE. import numpy as np import pytest -from arraycontext import PyOpenCLArrayContext, thaw, _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from arraycontext import thaw + +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.dof_array import flat_norm import logging diff --git a/test/test_mesh.py b/test/test_mesh.py index 3c1e6ac7..9182acb8 100644 --- a/test/test_mesh.py +++ b/test/test_mesh.py @@ -25,10 +25,10 @@ import numpy as np import numpy.linalg as la import pytest -from arraycontext import _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.mesh import Mesh, SimplexElementGroup, TensorProductElementGroup from meshmode.discretization.poly_element import ( diff --git a/test/test_meshmode.py b/test/test_meshmode.py index 8367130b..224fc013 100644 --- a/test/test_meshmode.py +++ b/test/test_meshmode.py @@ -26,12 +26,12 @@ import numpy as np import numpy.linalg as la import meshmode # noqa: F401 -from arraycontext import ( # noqa - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests, - thaw) +from arraycontext import thaw -from arraycontext import _acf # noqa: F401 +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.mesh import SimplexElementGroup, TensorProductElementGroup from meshmode.discretization.poly_element import ( diff --git a/test/test_modal.py b/test/test_modal.py index 7f785cbc..217f7fcf 100644 --- a/test/test_modal.py +++ b/test/test_modal.py @@ -24,11 +24,11 @@ THE SOFTWARE. from functools import partial import numpy as np -from arraycontext import thaw, _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests - ) +from arraycontext import thaw +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.dof_array import DOFArray, flat_norm from meshmode.mesh import ( diff --git a/test/test_partition.py b/test/test_partition.py index 0736087f..1ba599f9 100644 --- a/test/test_partition.py +++ b/test/test_partition.py @@ -28,10 +28,11 @@ import pyopencl as cl from meshmode.dof_array import flatten, unflatten, flat_norm -from arraycontext import thaw, _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from arraycontext import thaw +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.discretization.poly_element import default_simplex_group_factory from meshmode.mesh import BTAG_ALL diff --git a/test/test_refinement.py b/test/test_refinement.py index 3a28b3fd..ec8ad10c 100644 --- a/test/test_refinement.py +++ b/test/test_refinement.py @@ -26,10 +26,12 @@ from functools import partial import numpy as np import pytest -from arraycontext import thaw, _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from arraycontext import thaw + +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) from meshmode.dof_array import flat_norm from meshmode.mesh.refinement.utils import check_nodal_adj_against_geometry diff --git a/test/test_visualization.py b/test/test_visualization.py index da5a3a80..935c4e0b 100644 --- a/test/test_visualization.py +++ b/test/test_visualization.py @@ -39,10 +39,11 @@ from meshmode.discretization.poly_element import ( ) import meshmode.mesh.generation as mgen -from arraycontext import thaw, _acf # noqa: F401 -from arraycontext import ( # noqa: F401 - pytest_generate_tests_for_pyopencl_array_context - as pytest_generate_tests) +from arraycontext import thaw +from meshmode.array_context import PytestPyOpenCLArrayContextFactory +from arraycontext import pytest_generate_tests_for_array_contexts +pytest_generate_tests = pytest_generate_tests_for_array_contexts( + [PytestPyOpenCLArrayContextFactory]) # {{{ test visualizer -- GitLab