Skip to content

Commit 5f47ff7

Browse files
authored
remove cache options (#158)
* remove cache options * allow implicit re-exports * mypy 0.971 seems to be more strict about re-exports * flake * mypy 0.971
1 parent c550aa8 commit 5f47ff7

File tree

4 files changed

+7
-46
lines changed

4 files changed

+7
-46
lines changed

pyproject.toml

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ python = ">=3.8,<3.11"
3535
types-pytz = ">= 2022.1.1"
3636

3737
[tool.poetry.dev-dependencies]
38-
mypy = ">=0.961"
38+
mypy = ">=0.971"
3939
pytest = ">=7.1.2"
4040
pyright = ">=1.1.255"
4141
poethepoet = ">=0.13.1"
@@ -53,36 +53,15 @@ build-backend = "poetry.core.masonry.api"
5353

5454
[tool.poe.tasks.test_all]
5555
help = "Run all tests"
56-
script = "scripts.test:test(clean_cache, src=True, dist=True)"
57-
58-
[[tool.poe.tasks.test_all.args]]
59-
help = "remove cache folders (mypy and pytest)"
60-
name = "clean-cache"
61-
options = ["-c", "--clean_cache"]
62-
default = false
63-
type = "boolean"
56+
script = "scripts.test:test(src=True, dist=True)"
6457

6558
[tool.poe.tasks.test_src]
6659
help = "Run local tests (includes 'mypy_src', 'pyright_src', 'pytest', and 'style')"
67-
script = "scripts.test:test(clean_cache, src=True)"
68-
69-
[[tool.poe.tasks.test_src.args]]
70-
help = "remove cache folders (mypy and pytest)"
71-
name = "clean-cache"
72-
options = ["-c", "--clean_cache"]
73-
default = false
74-
type = "boolean"
60+
script = "scripts.test:test(src=True)"
7561

7662
[tool.poe.tasks.test_dist]
7763
help = "Run tests on the installed stubs (includes 'mypy_dist' and 'pyright_dist')"
78-
script = "scripts.test:test(clean_cache, dist=True)"
79-
80-
[[tool.poe.tasks.test_dist.args]]
81-
help = "remove cache folders (mypy and pytest)"
82-
name = "clean-cache"
83-
options = ["-c", "--clean_cache"]
84-
default = false
85-
type = "boolean"
64+
script = "scripts.test:test(dist=True)"
8665

8766
[tool.poe.tasks.pytest]
8867
help = "Run pytest"
@@ -98,15 +77,15 @@ script = "scripts.test.run:mypy_src"
9877

9978
[tool.poe.tasks.mypy_dist]
10079
help = "Run mypy on 'tests' using the installed stubs"
101-
script = "scripts.test:test(clean_cache=False, dist=True, type_checker='mypy')"
80+
script = "scripts.test:test(dist=True, type_checker='mypy')"
10281

10382
[tool.poe.tasks.pyright_src]
10483
help = "Run pyright on 'tests' (using the local stubs) and on the local stubs"
10584
script = "scripts.test.run:pyright_src"
10685

10786
[tool.poe.tasks.pyright_dist]
10887
help = "Run pyright on 'tests' using the installed stubs"
109-
script = "scripts.test:test(clean_cache=False, dist=True, type_checker='pyright')"
88+
script = "scripts.test:test(dist=True, type_checker='pyright')"
11089

11190

11291

scripts/test/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from scripts._job import run_job
44
from scripts.test import _step
55

6-
_CACHE_STEPS = [_step.clean_mypy_cache, _step.clean_pytest_cache]
76
_SRC_STEPS = [_step.mypy_src, _step.pyright_src, _step.pytest, _step.style]
87
_DIST_STEPS = [
98
_step.build_dist,
@@ -17,15 +16,11 @@
1716

1817

1918
def test(
20-
clean_cache: bool = False,
2119
src: bool = False,
2220
dist: bool = False,
2321
type_checker: Literal["", "mypy", "pyright"] = "",
2422
):
2523
steps = []
26-
if clean_cache:
27-
steps.extend(_CACHE_STEPS)
28-
2924
if src:
3025
steps.extend(_SRC_STEPS)
3126

scripts/test/_step.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from scripts._job import Step
22
from scripts.test import run
33

4-
clean_mypy_cache = Step(name="Clean mypy cache", run=run.clean_mypy_cache)
5-
clean_pytest_cache = Step(name="Clean pytest cache", run=run.clean_pytest_cache)
64
mypy_src = Step(
75
name="Run mypy on 'tests' (using the local stubs) and on the local stubs",
86
run=run.mypy_src,

scripts/test/run.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from pathlib import Path
2-
import shutil
32
import subprocess
43

54

@@ -14,7 +13,7 @@ def pyright_src():
1413

1514

1615
def pytest():
17-
cmd = ["pytest"]
16+
cmd = ["pytest", "--cache-clear"]
1817
subprocess.run(cmd, check=True)
1918

2019

@@ -61,13 +60,3 @@ def restore_src():
6160
Path(r"_pandas-stubs").rename("pandas-stubs")
6261
else:
6362
raise FileNotFoundError("'_pandas-stubs' folder does not exists.")
64-
65-
66-
def clean_mypy_cache():
67-
if Path(".mypy_cache").exists():
68-
shutil.rmtree(".mypy_cache")
69-
70-
71-
def clean_pytest_cache():
72-
if Path(".mypy_cache").exists():
73-
shutil.rmtree(".pytest_cache")

0 commit comments

Comments
 (0)