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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
name: Unittest report ${{ matrix.os }}-${{ matrix.pixi-environment }}
path: ${{ env.COVERAGE_REPORT }}
flaky-unit-test:
name: "Flaky unit tests: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests -m 'flaky'"
name: "Flaky unit tests: ${{ matrix.os }} | pixi run -e ${{ matrix.pixi-environment }} tests-flaky"
runs-on: ${{ matrix.os }}-latest
needs: [cache-pixi-lock]
permissions:
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:
- name: Unit test
id: unit-test
run: |
pixi run -e ${{ matrix.pixi-environment }} tests -m 'flaky' -v -s --cov=parcels --cov-report=xml --html="${COVERAGE_REPORT}" --self-contained-html
pixi run -e ${{ matrix.pixi-environment }} tests-flaky -v -s --cov=parcels --cov-report=xml --html="${COVERAGE_REPORT}" --self-contained-html
# explicitly save the cache so it gets updated, also do this even if it fails.
- name: Save cached hypothesis directory
id: save-hypothesis-cache
Expand Down
1 change: 1 addition & 0 deletions docs/development/maintainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

## Release checklist

- Run the validation test suite (`pixi run tests-validation`)
- Go to GitHub, draft new release. Enter name of version and "create new tag" if it doesn't already exist. Click "Generate Release Notes". Currate release notes as needed. Look at a previous version release to match the format (title, header, section organisation etc.)
- Go to [conda-forge/parcels-feedstock](https://github.com/conda-forge/parcels-feedstock), create a new issue (select the "Bot Commands" issue from the menu) with title `@conda-forge-admin, please update version`. This will prompt a build, otherwise there can be a delay in the build.
- Approve PR and merge on green
Expand Down
4 changes: 3 additions & 1 deletion pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ pytest-html = "*"
pytest-cov = "*"

[feature.test.tasks]
tests = { cmd = "pytest -m 'not flaky'", description = "Run the test suite." }
tests = { cmd = "pytest", description = "Run the test suite." }
tests-flaky = { cmd = "pytest -m 'flaky'", description = "Run flaky tests." }
tests-validation = { cmd = "pytest -m 'validation'", description = "Run validation tests." }
tests-notebooks = { cmd = "pytest --nbval-lax docs/user_guide/examples", description = "Run the user guide example notebooks as tests." }


Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ testpaths = ["tests"]
python_files = ["test_*.py", "example_*.py", "*tutorial*"]
minversion = "7"
markers = [ # can be skipped by doing `pytest -m "not slow"` etc.
"flaky: flaky tests",
"slow: slow tests",
"validation: validation tests (skipped by default, run with `-m validation`)",
"flaky: flaky tests (skipped by default, run with `-m flaky`)",
"v4alpha: failing tests that should work for v4alpha",
"v4future: failing tests that should work for a future release of v4",
"v4remove: failing tests that should probably be removed later",
Expand Down
14 changes: 14 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import pytest

SKIP_BY_DEFAULT = {"validation", "flaky"}


def pytest_collection_modifyitems(config, items):
if not config.getoption("-m"):
for item in items:
print(item.keywords)
skip_by_default = list(SKIP_BY_DEFAULT & set(item.keywords))
if skip_by_default:
skip_marker = skip_by_default[0] # get first marker in case of multiple
item.add_marker(
pytest.mark.skip(reason=f"{skip_marker} tests skipped by default, use `-m {skip_marker}` to run")
)


@pytest.fixture
def tmp_parquet(tmp_path):
Expand Down
Empty file added tests/validation/__init__.py
Empty file.
4 changes: 3 additions & 1 deletion tests/uxvalidation.py → tests/validation/test_ux.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
AdvectionRK4_3D,
)

pytestmark = pytest.mark.validation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? Does not seem to be used in the rest of the script?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used by Pytest (pytest is a mildly magical package in the sense that it looks for these sorts of specially named things). It marks the whole module as validation

You can see that by doing pytest -m validation


# Uniform translation parameters
T1_1_U0 = 0.001
T1_1_V0 = 0.0005
Expand Down Expand Up @@ -67,7 +69,7 @@
)
@pytest.mark.parametrize("integrator", [AdvectionEE, AdvectionRK4], ids=["EE", "RK4"])
def test_uniform_translation_exact(dataset_fn, integrator):
ds = dataset_fn(nx=20, U0=T1_1_U0, V0=T1_1_V0)
ds = dataset_fn(nx=20, u0=T1_1_U0, v0=T1_1_V0)
fieldset = parcels.FieldSet.from_ugrid_conventions(ds, mesh="flat")

pset = parcels.ParticleSet(fieldset, lon=[T1_1_LON0], lat=[T1_1_LAT0])
Expand Down
Loading