From 4b2f7329604058f7fd193af64447248d9f79affa Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:12:31 +0100 Subject: [PATCH] Add runtime type checking in CI tests This should prevent TYPE_CHECKING misuse. It might also found issues not found by static type checking, typically by the current MyPy. --- .github/workflows/ci.yaml | 5 +++++ pyproject.toml | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1a08b4c5903..028e21a342a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,6 +126,10 @@ jobs: run: | python -m pip install pytest-github-actions-annotate-failures + - name: Install beartype + run: | + python -m pip install pytest-beartype + - name: Install xarray run: | python -m pip install --no-deps -e . @@ -152,6 +156,7 @@ jobs: --cov=xarray --cov-report=xml --junitxml=pytest.xml + --beartype-packages=xarray - name: Upload test results if: always() diff --git a/pyproject.toml b/pyproject.toml index b886ee78b6f..3e3a265130b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,6 +41,7 @@ dev = [ "mypy", "pre-commit", "pytest", + "pytest-beartype", "pytest-cov", "pytest-env", "pytest-xdist",