Skip to content

Commit 5f5dd22

Browse files
[pre-commit.ci] pre-commit suggestions (#236)
* [pre-commit.ci] pre-commit suggestions updates: - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0) - [github.com/crate-ci/typos: v1.22.9 → v1.26.0](crate-ci/typos@v1.22.9...v1.26.0) - [github.com/pre-commit/mirrors-prettier: v3.1.0 → v4.0.0-alpha.8](pre-commit/mirrors-prettier@v3.1.0...v4.0.0-alpha.8) - [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.6.9](astral-sh/ruff-pre-commit@v0.5.0...v0.6.9) - [github.com/tox-dev/pyproject-fmt: 2.1.3 → 2.2.4](tox-dev/pyproject-fmt@2.1.3...2.2.4) - [github.com/abravalheri/validate-pyproject: v0.18 → v0.20.2](abravalheri/validate-pyproject@v0.18...v0.20.2) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 84768d9 commit 5f5dd22

7 files changed

Lines changed: 56 additions & 52 deletions

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ci:
99

1010
repos:
1111
- repo: https://github.com/pre-commit/pre-commit-hooks
12-
rev: v4.6.0
12+
rev: v5.0.0
1313
hooks:
1414
- id: end-of-file-fixer
1515
- id: trailing-whitespace
@@ -23,7 +23,7 @@ repos:
2323
- id: detect-private-key
2424

2525
- repo: https://github.com/crate-ci/typos
26-
rev: v1.22.9
26+
rev: v1.26.0
2727
hooks:
2828
- id: typos
2929
# empty to do not write fixes
@@ -47,7 +47,7 @@ repos:
4747
args: ["--number"]
4848

4949
- repo: https://github.com/pre-commit/mirrors-prettier
50-
rev: v3.1.0
50+
rev: v4.0.0-alpha.8
5151
hooks:
5252
- id: prettier
5353
files: \.(json|yml|yaml|toml)
@@ -60,7 +60,7 @@ repos:
6060
# - id: mypy
6161

6262
- repo: https://github.com/astral-sh/ruff-pre-commit
63-
rev: v0.5.0
63+
rev: v0.6.9
6464
hooks:
6565
# use black formatting
6666
- id: ruff-format
@@ -71,11 +71,11 @@ repos:
7171
args: ["--fix"]
7272

7373
- repo: https://github.com/tox-dev/pyproject-fmt
74-
rev: 2.1.3
74+
rev: 2.2.4
7575
hooks:
7676
- id: pyproject-fmt
7777
additional_dependencies: [tox]
7878
- repo: https://github.com/abravalheri/validate-pyproject
79-
rev: v0.18
79+
rev: v0.20.2
8080
hooks:
8181
- id: validate-pyproject

tests/test_core_lookup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Testing a few basic cachier interfaces."""
22

33
import pytest
4+
45
from cachier import cachier, get_default_params
56
from cachier.cores.mongo import MissingMongetter
67

tests/test_defaults.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
import threading
66
import time
77

8-
import cachier
98
import pytest
109

10+
import cachier
1111
from tests.test_mongo_core import _test_mongetter
1212

1313
MONGO_DELTA = datetime.timedelta(seconds=3)
@@ -65,7 +65,7 @@ def global_test_2():
6565
assert global_test_2.cache_dpath() is not None
6666

6767

68-
@pytest.mark.mongo()
68+
@pytest.mark.mongo
6969
def test_mongetter_default_param():
7070
cachier.set_default_params(mongetter=_test_mongetter)
7171

tests/test_general.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
from random import random
1111
from time import sleep, time
1212

13-
import cachier
1413
import pytest
14+
15+
import cachier
1516
from cachier.core import (
1617
DEFAULT_MAX_WORKERS,
1718
MAX_WORKERS_ENVAR_NAME,
1819
_get_executor,
1920
_max_workers,
2021
_set_max_workers,
2122
)
22-
2323
from tests.test_mongo_core import (
2424
_test_mongetter,
2525
)

tests/test_memory_core.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import pandas as pd
1111
import pytest
12+
1213
from cachier import cachier
1314

1415

@@ -19,7 +20,7 @@ def _takes_2_seconds(arg_1, arg_2):
1920
return f"arg_1:{arg_1}, arg_2:{arg_2}"
2021

2122

22-
@pytest.mark.memory()
23+
@pytest.mark.memory
2324
def test_memory_core():
2425
"""Basic memory core functionality."""
2526
_takes_2_seconds.clear_cache()
@@ -31,7 +32,7 @@ def test_memory_core():
3132
_takes_2_seconds.clear_cache()
3233

3334

34-
@pytest.mark.memory()
35+
@pytest.mark.memory
3536
def test_memory_core_keywords():
3637
"""Basic memory core functionality with keyword arguments."""
3738
_takes_2_seconds.clear_cache()
@@ -53,7 +54,7 @@ def _stale_after_seconds(arg_1, arg_2):
5354
return random()
5455

5556

56-
@pytest.mark.memory()
57+
@pytest.mark.memory
5758
def test_stale_after():
5859
"""Testing the stale_after functionality."""
5960
_stale_after_seconds.clear_cache()
@@ -74,7 +75,7 @@ def _stale_after_next_time(arg_1, arg_2):
7475
return random()
7576

7677

77-
@pytest.mark.memory()
78+
@pytest.mark.memory
7879
def test_stale_after_next_time():
7980
"""Testing the stale_after with next_time functionality."""
8081
_stale_after_next_time.clear_cache()
@@ -103,7 +104,7 @@ def _random_num_with_arg(a):
103104
return random()
104105

105106

106-
@pytest.mark.memory()
107+
@pytest.mark.memory
107108
def test_overwrite_cache():
108109
"""Tests that the overwrite feature works correctly."""
109110
_random_num.clear_cache()
@@ -127,7 +128,7 @@ def test_overwrite_cache():
127128
_random_num_with_arg.clear_cache()
128129

129130

130-
@pytest.mark.memory()
131+
@pytest.mark.memory
131132
def test_ignore_cache():
132133
"""Tests that the ignore_cache feature works correctly."""
133134
_random_num.clear_cache()
@@ -165,7 +166,7 @@ def _calls_takes_time(res_queue):
165166
res_queue.put(res)
166167

167168

168-
@pytest.mark.memory()
169+
@pytest.mark.memory
169170
def test_memory_being_calculated():
170171
"""Testing memory core handling of being calculated scenarios."""
171172
_takes_time.clear_cache()
@@ -199,7 +200,7 @@ def _calls_being_calc_next_time(res_queue):
199200
res_queue.put(res)
200201

201202

202-
@pytest.mark.memory()
203+
@pytest.mark.memory
203204
def test_being_calc_next_time():
204205
"""Testing memory core handling of being calculated scenarios."""
205206
_takes_time.clear_cache()
@@ -241,7 +242,7 @@ def _delete_cache(arg_1, arg_2):
241242
return random() + arg_1 + arg_2
242243

243244

244-
@pytest.mark.memory()
245+
@pytest.mark.memory
245246
def test_clear_being_calculated():
246247
"""Test memory core clear `being calculated` functionality."""
247248
_takes_time.clear_cache()
@@ -264,7 +265,7 @@ def test_clear_being_calculated():
264265
assert res1 != res2
265266

266267

267-
@pytest.mark.memory()
268+
@pytest.mark.memory
268269
def test_clear_being_calculated_with_empty_cache():
269270
"""Test memory core clear `being calculated` functionality."""
270271
_takes_time.clear_cache()
@@ -281,7 +282,7 @@ def _error_throwing_func(arg1):
281282
return 7
282283

283284

284-
@pytest.mark.memory()
285+
@pytest.mark.memory
285286
def test_error_throwing_func():
286287
# with
287288
res1 = _error_throwing_func(4)
@@ -290,7 +291,7 @@ def test_error_throwing_func():
290291
assert res1 == res2
291292

292293

293-
@pytest.mark.memory()
294+
@pytest.mark.memory
294295
def test_callable_hash_param():
295296
def _hash_func(args, kwargs):
296297
def _hash(obj):

tests/test_mongo_core.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
import pymongo
1515
import pytest
1616
from birch import Birch # type: ignore[import-not-found]
17-
from cachier import cachier
18-
from cachier.cores.base import RecalculationNeeded
19-
from cachier.cores.mongo import _MongoCore
2017
from pymongo.errors import OperationFailure
2118
from pymongo.mongo_client import MongoClient
2219
from pymongo_inmemory import MongoClient as InMemoryMongoClient
2320

21+
from cachier import cachier
22+
from cachier.cores.base import RecalculationNeeded
23+
from cachier.cores.mongo import _MongoCore
24+
2425
# === Enables testing vs a real MongoDB instance ===
2526

2627

@@ -76,13 +77,13 @@ def _test_mongetter():
7677
# === Mongo core tests ===
7778

7879

79-
@pytest.mark.mongo()
80+
@pytest.mark.mongo
8081
def test_information():
8182
print("\npymongo version: ", end="")
8283
print(pymongo.__version__)
8384

8485

85-
@pytest.mark.mongo()
86+
@pytest.mark.mongo
8687
def test_mongo_index_creation():
8788
"""Basic Mongo core functionality."""
8889

@@ -99,7 +100,7 @@ def _test_mongo_caching(arg_1, arg_2):
99100
assert _MongoCore._INDEX_NAME in collection.index_information()
100101

101102

102-
@pytest.mark.mongo()
103+
@pytest.mark.mongo
103104
def test_mongo_core():
104105
"""Basic Mongo core functionality."""
105106

@@ -122,7 +123,7 @@ def _test_mongo_caching(arg_1, arg_2):
122123
assert val6 == val5
123124

124125

125-
@pytest.mark.mongo()
126+
@pytest.mark.mongo
126127
def test_mongo_core_keywords():
127128
"""Basic Mongo core functionality with keyword arguments."""
128129

@@ -145,7 +146,7 @@ def _test_mongo_caching(arg_1, arg_2):
145146
assert val6 == val5
146147

147148

148-
@pytest.mark.mongo()
149+
@pytest.mark.mongo
149150
def test_mongo_stale_after():
150151
"""Testing MongoDB core stale_after functionality."""
151152

@@ -178,7 +179,7 @@ def _takes_time(arg_1, arg_2):
178179
res_queue.put(res)
179180

180181

181-
@pytest.mark.mongo()
182+
@pytest.mark.mongo
182183
def test_mongo_being_calculated():
183184
"""Testing MongoDB core handling of being calculated scenarios."""
184185

@@ -228,7 +229,7 @@ def _bad_mongetter():
228229
return _BadMongoCollection(_test_mongetter)
229230

230231

231-
@pytest.mark.mongo()
232+
@pytest.mark.mongo
232233
def test_mongo_write_failure():
233234
"""Testing MongoDB core handling of writing failure scenarios."""
234235

@@ -244,7 +245,7 @@ def _func_w_bad_mongo(arg_1, arg_2):
244245
# assert val1 == val2
245246

246247

247-
@pytest.mark.mongo()
248+
@pytest.mark.mongo
248249
def test_mongo_clear_being_calculated():
249250
"""Testing MongoDB core clear_being_calculated."""
250251

@@ -256,7 +257,7 @@ def _func_w_bad_mongo(arg_1, arg_2):
256257
_func_w_bad_mongo.clear_being_calculated()
257258

258259

259-
@pytest.mark.mongo()
260+
@pytest.mark.mongo
260261
def test_stalled_mongo_db_cache():
261262
@cachier(mongetter=_test_mongetter)
262263
def _stalled_func():
@@ -269,7 +270,7 @@ def _stalled_func():
269270
core.wait_on_entry_calc(key=None)
270271

271272

272-
@pytest.mark.mongo()
273+
@pytest.mark.mongo
273274
def test_stalled_mong_db_core(monkeypatch):
274275
def mock_get_entry(self, args, kwargs):
275276
return "key", {"being_calculated": True}
@@ -325,7 +326,7 @@ def _stalled_func_3():
325326
assert res == 1
326327

327328

328-
@pytest.mark.mongo()
329+
@pytest.mark.mongo
329330
def test_callable_hash_param():
330331
def _hash_func(args, kwargs):
331332
def _hash(obj):

0 commit comments

Comments
 (0)