Skip to content

Commit d0fe175

Browse files
committed
Support testing np and tnp on the same test
Rudimentary example of usage in `test_indexing.py`
1 parent 1272d80 commit d0fe175

File tree

2 files changed

+214
-176
lines changed

2 files changed

+214
-176
lines changed

torch_np/tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ def __getattribute__(self, attr):
2222
sys.modules["numpy"] = Inaccessible()
2323

2424

25+
def pytest_generate_tests(metafunc):
26+
import numpy as np
27+
28+
import torch_np as tnp
29+
30+
if "np" in metafunc.fixturenames:
31+
metafunc.parametrize("np", [np, tnp])
32+
33+
2534
def pytest_collection_modifyitems(config, items):
2635
if not config.getoption("--runslow"):
2736
skip_slow = pytest.mark.skip(reason="slow test, use --runslow to run")

0 commit comments

Comments
 (0)