Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/unit/autogram/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,13 @@ def test_compute_gramian(architecture: type[ShapedModule], batch_size: int, batc

@mark.parametrize(
"architecture",
[WithBatchNorm, WithSideEffect, Randomness, WithModuleTrackingRunningStats, WithRNN],
[
WithBatchNorm,
WithSideEffect,
Randomness,
WithModuleTrackingRunningStats,
param(WithRNN, marks=mark.xfail_if_cuda),
],
)
@mark.parametrize("batch_size", [1, 3, 32])
@mark.parametrize("batch_dim", [param(0, marks=mark.xfail), None])
Expand Down
9 changes: 5 additions & 4 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ def pytest_addoption(parser):

def pytest_configure(config):
config.addinivalue_line("markers", "slow: mark test as slow to run")
config.addinivalue_line("markers", "xfail_if_cuda: mark test as xfail if running on cuda")


def pytest_collection_modifyitems(config, items):
if config.getoption("--runslow"):
return

skip_slow = mark.skip(reason="Slow test. Use --runslow to run it.")
xfail_cuda = mark.xfail(reason=f"Test expected to fail on {DEVICE}")
for item in items:
if "slow" in item.keywords:
if "slow" in item.keywords and not config.getoption("--runslow"):
item.add_marker(skip_slow)
if "xfail_if_cuda" in item.keywords and str(DEVICE).startswith("cuda"):
item.add_marker(xfail_cuda)
Loading