Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Pytest Slow Mark #41

Merged
merged 5 commits into from
Feb 15, 2024
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
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ by [CI pipelines](#CI). Before pushing your changes to the remote we recommend
to execute `pytest` locally in order to detect mistakes early on and to avoid
failing pipelines.

Slow tests (> 5s) are marked by the `@pytest.mark.slow` decorator.
To run all tests except the slow ones, use:

```shell
pytest -m "not slow"
```

## Notebooks

We use notebooks both as documentation (copied over to `docs/examples`) and as
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]
# See configuration details in https://github.com/pypa/setuptools_scm
version_scheme = "no-guess-dev"

[tool.pytest.ini_options]
markers = [
"slow: marks tests as slow (> 5s)",
]
2 changes: 2 additions & 0 deletions tests/operators/test_deeponet.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import torch
import matplotlib.pyplot as plt
import pytest

from continuity.plotting import plot, plot_evaluation
from torch.utils.data import DataLoader
Expand Down Expand Up @@ -40,6 +41,7 @@ def test_output_shape():
assert v_other_pred.shape == v_other.shape


@pytest.mark.slow
def test_deeponet():
# Parameters
num_sensors = 16
Expand Down
2 changes: 2 additions & 0 deletions tests/operators/test_neuraloperator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import torch
import matplotlib.pyplot as plt
from continuity.data import Sine
Expand All @@ -9,6 +10,7 @@
torch.manual_seed(0)


@pytest.mark.slow
def test_neuraloperator():
# Parameters
num_sensors = 16
Expand Down
2 changes: 2 additions & 0 deletions tests/test_optuna.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pytest
import torch
from torch.utils.data import DataLoader
from continuity.benchmarks.sine import SineBenchmark
Expand All @@ -10,6 +11,7 @@
torch.manual_seed(0)


@pytest.mark.slow
def test_optuna():
def objective(trial):
trunk_width = trial.suggest_int("trunk_width", 4, 16)
Expand Down
Loading