Skip to content

Commit 383e0e9

Browse files
Fix failing tests due to fixture caching
1 parent 07ad611 commit 383e0e9

8 files changed

+34
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ coverage.xml
4444
*.cover
4545
*.py,cover
4646
.pytest_cache/
47+
pytest.xml
4748

4849
# Translations
4950
*.mo

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.11.0
10+
rev: v0.11.13
1111
hooks:
1212
- id: ruff
1313
args:
@@ -29,6 +29,10 @@ repos:
2929
hooks:
3030
- id: codespell
3131
additional_dependencies: [tomli]
32+
- repo: https://github.com/gitleaks/gitleaks
33+
rev: v8.21.2
34+
hooks:
35+
- id: gitleaks
3236
- repo: https://github.com/pre-commit/pre-commit-hooks
3337
rev: v5.0.0
3438
hooks:
@@ -85,4 +89,8 @@ repos:
8589
- --max-average=B
8690
- --max-modules=B
8791
- --max-absolute=C
92+
- repo: https://github.com/rbubley/mirrors-prettier
93+
rev: v3.3.3
94+
hooks:
95+
- id: prettier
8896
exclude: '\.nc$|^tests/fixture/|\.ipynb$'

CHANGELOG.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137
**Implemented enhancements:**
138138

139-
- Add a command-line interface [\#82](https://github.com/btschwertfeger/python-cmethods/issues/82)
139+
- Add a command-line interface [\#82](https://github.com/btschwertfeger/python-cmethods/issues/82)
140140
- Resolve "Add a command-line interface" [\#83](https://github.com/btschwertfeger/python-cmethods/pull/83) ([btschwertfeger](https://github.com/btschwertfeger))
141141

142142
**Merged pull requests:**
@@ -175,7 +175,7 @@
175175

176176
**Closed issues:**
177177

178-
- The latest documentation still describes the legacy max\_scaling\_factor [\#60](https://github.com/btschwertfeger/python-cmethods/issues/60)
178+
- The latest documentation still describes the legacy max_scaling_factor [\#60](https://github.com/btschwertfeger/python-cmethods/issues/60)
179179

180180
**Merged pull requests:**
181181

@@ -223,7 +223,7 @@
223223

224224
**Merged pull requests:**
225225

226-
- Clarified difference between stochastic and non-stochastic climate variables in doc and readme [\#36](https://github.com/btschwertfeger/python-cmethods/pull/36) ([btschwertfeger](https://github.com/btschwertfeger))
226+
- Clarified difference between stochastic and non-stochastic climate variables in doc and readme [\#36](https://github.com/btschwertfeger/python-cmethods/pull/36) ([btschwertfeger](https://github.com/btschwertfeger))
227227
- Fix typos [\#38](https://github.com/btschwertfeger/python-cmethods/pull/38) ([btschwertfeger](https://github.com/btschwertfeger))
228228

229229
## [v1.0.1](https://github.com/btschwertfeger/python-cmethods/tree/v1.0.1) (2023-04-17)
@@ -237,7 +237,7 @@
237237

238238
**Fixed bugs:**
239239

240-
- Multiplicative Quantile Delta Mapping is not applying scaling where the delta is infinite [\#32](https://github.com/btschwertfeger/python-cmethods/issues/32)
240+
- Multiplicative Quantile Delta Mapping is not applying scaling where the delta is infinite [\#32](https://github.com/btschwertfeger/python-cmethods/issues/32)
241241
- Fixed PyPI repository URL [\#16](https://github.com/btschwertfeger/python-cmethods/pull/16) ([btschwertfeger](https://github.com/btschwertfeger))
242242
- Fixed bug where division lead to nan or inf values [\#33](https://github.com/btschwertfeger/python-cmethods/pull/33) ([btschwertfeger](https://github.com/btschwertfeger))
243243

@@ -257,7 +257,7 @@
257257

258258
**Breaking changes:**
259259

260-
- Remove the unnecessary `CMethods.py` module to access the CMethods class more easily [\#10](https://github.com/btschwertfeger/python-cmethods/issues/10)
260+
- Remove the unnecessary `CMethods.py` module to access the CMethods class more easily [\#10](https://github.com/btschwertfeger/python-cmethods/issues/10)
261261

262262
**Implemented enhancements:**
263263

@@ -282,7 +282,7 @@
282282

283283
**Breaking changes:**
284284

285-
- adjust\_3d forces group to be "time.month" if group is set to the default \(None\) [\#5](https://github.com/btschwertfeger/python-cmethods/issues/5)
285+
- adjust_3d forces group to be "time.month" if group is set to the default \(None\) [\#5](https://github.com/btschwertfeger/python-cmethods/issues/5)
286286

287287
**Implemented enhancements:**
288288

@@ -340,6 +340,4 @@
340340

341341
[Full Changelog](https://github.com/btschwertfeger/python-cmethods/compare/41c1837e5d23c300656c8ee2ce0079d6a8baac2f...v0.5)
342342

343-
344-
345-
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
343+
\* _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ wip:
7272
##
7373
.PHONY: coverage
7474
coverage:
75-
@rm .cache/tests/*.log || true
7675
$(PYTEST) $(PYTEST_COV_OPTS) $(TEST_DIR)
7776

7877
## doc Build the documentation

pyproject.toml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ classifiers = [
6363
cmethods = "cmethods:cli"
6464

6565
[project.urls]
66-
"Homepage" = "https://github.com/btschwertfeger/python-cmethods"
66+
Homepage = "https://github.com/btschwertfeger/python-cmethods"
6767
"Bug Tracker" = "https://github.com/btschwertfeger/python-cmethods/issues"
68+
Documentation = "https://python-cmethods.readthedocs.io/en/stable/"
6869

6970
[tool.setuptools]
7071
include-package-data = false
@@ -84,7 +85,10 @@ testpaths = ["tests"]
8485

8586
[tool.pytest.ini_options]
8687
cache_dir = ".cache/pytest"
87-
markers = ["wip: Used to run a specific test by hand."]
88+
markers = [
89+
"wip: Used to run a specific test by hand.",
90+
"flaky: Use to retry flaky tests",
91+
]
8892
addopts = "--maxfail=1"
8993

9094
[tool.coverage.run]
@@ -201,6 +205,7 @@ lint.select = [
201205
"BLE", # blind-except
202206
"C4", # flake8-comprehensions
203207
"COM", # flake8-commas
208+
"CPY", # flake8-copyright
204209
"E", # pycodestyle
205210
"F", # pyflakes
206211
"FA", # flake8-future-annotations
@@ -256,6 +261,11 @@ line-length = 130
256261
cache-dir = ".cache/ruff"
257262
lint.task-tags = ["todo", "TODO"]
258263

264+
[tool.ruff.lint.flake8-copyright]
265+
author = "Benjamin Thomas Schwertfeger"
266+
notice-rgx = "(?i)Copyright \\(C\\) \\d{4}"
267+
min-file-size = 1024
268+
259269
[tool.ruff.lint.per-file-ignores]
260270
"cmethods/types.py" = [
261271
"A005", # Shadowing builtin

tests/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from __future__ import annotations
1111

1212
import os
13-
from functools import lru_cache
1413
from typing import Any
1514

1615
import pytest
@@ -65,7 +64,6 @@ def datasets() -> dict:
6564
}
6665

6766

68-
@lru_cache(maxsize=None)
6967
@pytest.fixture
7068
def datasets_from_zarr() -> dict:
7169
return {

tests/test_methods_different_input_shape.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121

2222
from .helper import is_1d_rmse_better
2323

24-
N_QUANTILES = 100
24+
pytestmark = [pytest.mark.flaky]
25+
26+
N_QUANTILES: int = 100
2527

2628

2729
@pytest.mark.parametrize(

tests/test_zarr_dask_compatibility.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
from .helper import is_3d_rmse_better
1717

18+
pytestmark = [pytest.mark.flaky]
19+
1820
GROUP: str = "time.month"
1921
N_QUANTILES: int = 100
2022

0 commit comments

Comments
 (0)