Skip to content

Commit

Permalink
tests: add --framework opt to pytest
Browse files Browse the repository at this point in the history
Allows us to specify which frameworks to test. This allows us to avoid
some crashes when different frameworks don't interact well (e.g., Numba
will fail if it's not given the primary context).
  • Loading branch information
janden committed Aug 24, 2023
1 parent ab64862 commit baa863b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions python/cufinufft/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
def pytest_addoption(parser):
parser.addoption("--framework", action="append", default=[], help="List of frameworks")

def pytest_generate_tests(metafunc):
if "framework" in metafunc.fixturenames:
metafunc.parametrize("framework", metafunc.config.getoption("framework"))
3 changes: 0 additions & 3 deletions python/cufinufft/tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

# NOTE: Tests below fail for tolerance 1e-4 (error executing plan).

FRAMEWORKS = ["pycuda", "cupy", "numba", "torch"]
DTYPES = [np.float32, np.float64]
SHAPES = [(16,), (16, 16), (16, 16, 16)]
MS = [256, 1024, 4096]
Expand Down Expand Up @@ -44,7 +43,6 @@ def to_cpu(obj):

return to_gpu, to_cpu

@pytest.mark.parametrize("framework", FRAMEWORKS)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("shape", SHAPES)
@pytest.mark.parametrize("M", MS)
Expand Down Expand Up @@ -78,7 +76,6 @@ def test_type1(framework, dtype, shape, M, tol, output_arg):
utils.verify_type1(k, c, fk, tol)


@pytest.mark.parametrize("framework", FRAMEWORKS)
@pytest.mark.parametrize("dtype", DTYPES)
@pytest.mark.parametrize("shape", SHAPES)
@pytest.mark.parametrize("M", MS)
Expand Down

0 comments on commit baa863b

Please sign in to comment.