crackerjack 0.10.8__tar.gz → 0.11.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crackerjack-0.10.8 → crackerjack-0.11.1}/PKG-INFO +4 -5
- crackerjack-0.11.1/crackerjack/.pdm.toml +1 -0
- crackerjack-0.11.1/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/__main__.py +1 -2
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/crackerjack.py +44 -71
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/pyproject.toml +13 -5
- {crackerjack-0.10.8 → crackerjack-0.11.1}/pyproject.toml +13 -5
- crackerjack-0.11.1/tests/test_crackerjack.py +0 -0
- crackerjack-0.11.1/tests/test_main.py +145 -0
- crackerjack-0.10.8/crackerjack/.ruff_cache/0.9.9/12813592349865671909 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/LICENSE +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/README.md +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.gitignore +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.pre-commit-config.yaml +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/.gitignore +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.11/3256171999636029978 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.14/602324811142551221 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.4/10355199064880463147 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.6/15140459877605758699 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.7/1790508110482614856 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.9/17041001205004563469 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.2.0/10047773857155985907 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.2.1/8522267973936635051 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.2.2/18053836298936336950 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.0/12548816621480535786 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.3/11081883392474770722 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.4/676973378459347183 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.5/16311176246009842383 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.5.7/1493622539551733492 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.5.7/6231957614044513175 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.5.7/9932762556785938009 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.0/11982804814124138945 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.0/12055761203849489982 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.2/1206147804896221174 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.4/1206147804896221174 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.5/1206147804896221174 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.7/3657366982708166874 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.9/285614542852677309 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.7.1/1024065805990144819 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.7.1/285614542852677309 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.7.3/16061516852537040135 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.8.4/16354268377385700367 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.9.3/13948373885254993391 +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/CACHEDIR.TAG +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/__init__.py +0 -0
- {crackerjack-0.10.8 → crackerjack-0.11.1}/tests/__init__.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: crackerjack
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.11.1
|
4
4
|
Summary: Default template for PDM package
|
5
5
|
Keywords: black,ruff,mypy,creosote,refurb
|
6
6
|
Author-Email: lesleslie <les@wedgwoodwebworks.com>
|
@@ -23,17 +23,16 @@ Project-URL: documentation, https://github.com/lesleslie/crackerjack
|
|
23
23
|
Project-URL: repository, https://github.com/lesleslie/crackerjack
|
24
24
|
Requires-Python: >=3.13
|
25
25
|
Requires-Dist: click>=8.1.8
|
26
|
-
Requires-Dist: aioconsole>=0.8.1
|
27
|
-
Requires-Dist: inflection>=0.5.1
|
28
26
|
Requires-Dist: autotyping>=24.9.0
|
29
27
|
Requires-Dist: pre-commit>=4.0.1
|
30
28
|
Requires-Dist: pytest>=8.3.4
|
31
29
|
Requires-Dist: pydantic>=2.10.4
|
32
|
-
Requires-Dist: aiopath>=0.7.7
|
33
30
|
Requires-Dist: pdm-bump>=0.9.10
|
34
31
|
Requires-Dist: pdm>=2.22.1
|
35
|
-
Requires-Dist: acb>=0.8.0
|
36
32
|
Requires-Dist: uv>=0.5.13
|
33
|
+
Requires-Dist: pytest-cov>=6.0.0
|
34
|
+
Requires-Dist: pytest-mock>=3.14.0
|
35
|
+
Requires-Dist: tomli-w>=1.2.0
|
37
36
|
Description-Content-Type: text/markdown
|
38
37
|
|
39
38
|
# Crackerjack Python
|
@@ -0,0 +1 @@
|
|
1
|
+
test crackerjack config
|
Binary file
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import asyncio
|
2
1
|
import typing as t
|
3
2
|
|
4
3
|
from click import command, help_option, option
|
@@ -58,7 +57,7 @@ def crackerjack(
|
|
58
57
|
if v:
|
59
58
|
print("-v not currently implemented")
|
60
59
|
options.verbose = v
|
61
|
-
|
60
|
+
crackerjack_it(options=options)
|
62
61
|
|
63
62
|
|
64
63
|
if __name__ == "__main__":
|
@@ -1,43 +1,33 @@
|
|
1
|
-
import asyncio
|
2
1
|
import re
|
3
|
-
import sys
|
4
2
|
import typing as t
|
5
3
|
from pathlib import Path
|
6
4
|
from subprocess import run as execute
|
5
|
+
from tomllib import loads
|
7
6
|
|
8
|
-
from acb.actions.encode import dump, load
|
9
|
-
from aioconsole import ainput, aprint
|
10
|
-
from aiopath import AsyncPath
|
11
|
-
from inflection import underscore
|
12
7
|
from pydantic import BaseModel
|
13
|
-
|
14
|
-
|
15
|
-
class Config(BaseModel):
|
16
|
-
python_version: str = "3.13"
|
8
|
+
from tomli_w import dumps
|
17
9
|
|
18
10
|
|
19
11
|
class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
20
|
-
our_path:
|
21
|
-
pkg_path:
|
22
|
-
|
23
|
-
pkg_dir: t.Optional[AsyncPath] = None
|
12
|
+
our_path: Path = Path(__file__).parent
|
13
|
+
pkg_path: Path = Path(Path.cwd())
|
14
|
+
pkg_dir: t.Optional[Path] = None
|
24
15
|
pkg_name: str = "crackerjack"
|
25
16
|
our_toml: t.Optional[dict[str, t.Any]] = None
|
26
17
|
pkg_toml: t.Optional[dict[str, t.Any]] = None
|
27
|
-
our_toml_path: t.Optional[
|
28
|
-
pkg_toml_path: t.Optional[
|
29
|
-
|
18
|
+
our_toml_path: t.Optional[Path] = None
|
19
|
+
pkg_toml_path: t.Optional[Path] = None
|
20
|
+
python_version: str = "3.13"
|
30
21
|
|
31
|
-
|
22
|
+
def update_pyproject_configs(self) -> None:
|
32
23
|
toml_file = "pyproject.toml"
|
33
24
|
self.our_toml_path = self.our_path / toml_file
|
34
25
|
self.pkg_toml_path = self.pkg_path / toml_file
|
35
26
|
if self.pkg_path.stem == "crackerjack":
|
36
|
-
|
27
|
+
self.our_toml_path.write_text(self.pkg_toml_path.read_text())
|
37
28
|
return
|
38
|
-
our_toml_config: t.Any =
|
39
|
-
pkg_toml_config: t.Any =
|
40
|
-
pkg_deps = pkg_toml_config["dependency-groups"]
|
29
|
+
our_toml_config: t.Any = loads(self.our_toml_path.read_text())
|
30
|
+
pkg_toml_config: t.Any = loads(self.pkg_toml_path.read_text())
|
41
31
|
for tool, settings in our_toml_config["tool"].items():
|
42
32
|
for setting, value in settings.items():
|
43
33
|
if isinstance(value, str | list) and "crackerjack" in value:
|
@@ -58,50 +48,47 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
58
48
|
pkg_toml_config["tool"][tool][setting] + value
|
59
49
|
)
|
60
50
|
pkg_toml_config["tool"][tool] = settings
|
61
|
-
pkg_toml_config["dependency-groups"] = pkg_deps
|
62
51
|
python_version_pattern = r"\s*W*(\d\.\d*)"
|
63
52
|
requires_python = our_toml_config["project"]["requires-python"]
|
64
53
|
classifiers = []
|
65
54
|
for classifier in pkg_toml_config["project"]["classifiers"]:
|
66
55
|
classifier = re.sub(
|
67
|
-
python_version_pattern, f" {self.
|
56
|
+
python_version_pattern, f" {self.python_version}", classifier
|
68
57
|
)
|
69
58
|
classifiers.append(classifier)
|
70
59
|
pkg_toml_config["project"]["classifiers"] = classifiers
|
71
60
|
pkg_toml_config["project"]["requires-python"] = requires_python
|
72
|
-
|
61
|
+
self.pkg_toml_path.write_text(dumps(pkg_toml_config))
|
73
62
|
|
74
|
-
|
63
|
+
def copy_configs(self) -> None:
|
75
64
|
config_files = (".gitignore", ".pre-commit-config.yaml", ".libcst.codemod.yaml")
|
76
65
|
for config in config_files:
|
77
66
|
config_path = self.our_path / config
|
78
67
|
pkg_config_path = self.pkg_path / config
|
79
|
-
|
68
|
+
pkg_config_path.touch()
|
80
69
|
if self.pkg_path.stem == "crackerjack":
|
81
|
-
|
70
|
+
config_path.write_text(pkg_config_path.read_text())
|
82
71
|
continue
|
83
72
|
if config != ".gitignore":
|
84
|
-
|
85
|
-
(
|
86
|
-
"crackerjack", self.pkg_name
|
87
|
-
)
|
73
|
+
pkg_config_path.write_text(
|
74
|
+
(config_path.read_text()).replace("crackerjack", self.pkg_name)
|
88
75
|
)
|
89
76
|
execute(["git", "add", config])
|
90
77
|
|
91
|
-
|
78
|
+
def run_interactive(self, hook: str) -> None:
|
92
79
|
success: bool = False
|
93
80
|
while not success:
|
94
81
|
fail = execute(["pre-commit", "run", hook.lower(), "--all-files"])
|
95
82
|
if fail.returncode > 0:
|
96
|
-
retry =
|
97
|
-
|
83
|
+
retry = input(f"\n\n{hook.title()} failed. Retry? (y/N): ")
|
84
|
+
print()
|
98
85
|
if retry.strip().lower() == "y":
|
99
86
|
continue
|
100
|
-
|
87
|
+
raise SystemExit(1)
|
101
88
|
success = True
|
102
89
|
|
103
|
-
|
104
|
-
|
90
|
+
def update_pkg_configs(self) -> None:
|
91
|
+
self.copy_configs()
|
105
92
|
installed_pkgs = execute(
|
106
93
|
["pdm", "list", "--freeze"],
|
107
94
|
capture_output=True,
|
@@ -117,71 +104,57 @@ class Crackerjack(BaseModel, arbitrary_types_allowed=True):
|
|
117
104
|
execute(["git", "add", "pdm.lock"])
|
118
105
|
execute(["pre-commit", "install"])
|
119
106
|
execute(["git", "config", "advice.addIgnoredFile", "false"])
|
120
|
-
|
121
|
-
|
122
|
-
async def load_config(self) -> None:
|
123
|
-
await self.settings_path.touch(exist_ok=True)
|
124
|
-
try:
|
125
|
-
self.config = Config(**await load.yaml(self.settings_path))
|
126
|
-
except TypeError:
|
127
|
-
self.config = Config()
|
128
|
-
await dump.yaml(self.config.model_dump(), self.settings_path)
|
129
|
-
raise SystemExit("\nPlease configure '.crackerjack.yaml' and try again\n")
|
107
|
+
self.update_pyproject_configs()
|
130
108
|
|
131
|
-
|
109
|
+
def run_pre_commit(self) -> None:
|
132
110
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
133
111
|
if check_all.returncode > 0:
|
134
112
|
check_all = execute(["pre-commit", "run", "--all-files"])
|
135
113
|
if check_all.returncode > 0:
|
136
|
-
|
137
|
-
raise SystemExit()
|
114
|
+
print("\n\nPre-commit failed. Please fix errors.\n")
|
115
|
+
raise SystemExit(1)
|
138
116
|
|
139
|
-
|
140
|
-
self.pkg_name =
|
117
|
+
def process(self, options: t.Any) -> None:
|
118
|
+
self.pkg_name = self.pkg_path.stem.lower().replace("-", "_")
|
141
119
|
self.pkg_dir = self.pkg_path / self.pkg_name
|
142
|
-
|
143
|
-
|
120
|
+
self.pkg_dir.mkdir(exist_ok=True)
|
121
|
+
print("\nCrackerjacking...\n")
|
144
122
|
if not options.do_not_update_configs:
|
145
|
-
|
123
|
+
self.update_pkg_configs()
|
146
124
|
execute(["pdm", "install"])
|
147
125
|
if self.pkg_path.stem == "crackerjack" and options.update_precommit:
|
148
126
|
execute(["pre-commit", "autoupdate"])
|
149
127
|
if options.interactive:
|
150
128
|
for hook in ("refurb", "bandit", "pyright"):
|
151
|
-
|
152
|
-
|
129
|
+
self.run_interactive(hook)
|
130
|
+
self.run_pre_commit()
|
153
131
|
for option in (options.publish, options.bump):
|
154
132
|
if option:
|
155
133
|
execute(["pdm", "bump", option])
|
156
134
|
break
|
157
135
|
if options.publish:
|
158
136
|
build = execute(["pdm", "build"], capture_output=True, text=True)
|
159
|
-
|
137
|
+
print(build.stdout)
|
160
138
|
if build.returncode > 0:
|
161
|
-
|
162
|
-
|
163
|
-
raise SystemExit()
|
139
|
+
print(build.stderr)
|
140
|
+
print("\n\nBuild failed. Please fix errors.\n")
|
141
|
+
raise SystemExit(1)
|
164
142
|
execute(["pdm", "publish", "--no-build"])
|
165
143
|
if options.commit:
|
166
|
-
commit_msg =
|
144
|
+
commit_msg = input("\nCommit message: ")
|
167
145
|
execute(
|
168
146
|
[
|
169
147
|
"git",
|
170
148
|
"commit",
|
171
149
|
"-m",
|
172
|
-
|
150
|
+
commit_msg,
|
173
151
|
"--no-verify",
|
174
152
|
"--",
|
175
153
|
".",
|
176
154
|
]
|
177
155
|
)
|
178
156
|
execute(["git", "push", "origin", "main"])
|
179
|
-
|
180
|
-
|
181
|
-
async def run(self, options: t.Any) -> None:
|
182
|
-
await self.load_config()
|
183
|
-
process = asyncio.create_task(self.process(options))
|
184
|
-
await process
|
157
|
+
print("\nCrackerjack complete!\n")
|
185
158
|
|
186
159
|
|
187
|
-
crackerjack_it = Crackerjack().
|
160
|
+
crackerjack_it = Crackerjack().process
|
@@ -1,3 +1,6 @@
|
|
1
|
+
[tool.pytest.ini_options]
|
2
|
+
addopts = "--cov=crackerjack"
|
3
|
+
|
1
4
|
[tool.codespell]
|
2
5
|
skip = "*/data/*"
|
3
6
|
quiet-level = 3
|
@@ -9,6 +12,7 @@ target-version = "py313"
|
|
9
12
|
fix = true
|
10
13
|
show-fixes = true
|
11
14
|
output-format = "full"
|
15
|
+
unsafe-fixes = true
|
12
16
|
|
13
17
|
[tool.ruff.format]
|
14
18
|
docstring-code-format = true
|
@@ -57,6 +61,9 @@ exclude-deps = [
|
|
57
61
|
"autotyping",
|
58
62
|
"pre-commit",
|
59
63
|
"pytest",
|
64
|
+
"pytest-asyncio",
|
65
|
+
"pytest-cov",
|
66
|
+
"pytest-mock",
|
60
67
|
"pdm",
|
61
68
|
"pyfiglet",
|
62
69
|
"pyyaml",
|
@@ -72,6 +79,7 @@ target = [
|
|
72
79
|
"crackerjack",
|
73
80
|
]
|
74
81
|
skips = [
|
82
|
+
"B101",
|
75
83
|
"B301",
|
76
84
|
"B311",
|
77
85
|
"B403",
|
@@ -79,6 +87,7 @@ skips = [
|
|
79
87
|
"B602",
|
80
88
|
"B603",
|
81
89
|
"B607",
|
90
|
+
"B704",
|
82
91
|
]
|
83
92
|
|
84
93
|
[tool.pyright]
|
@@ -105,7 +114,7 @@ pythonPlatform = "Darwin"
|
|
105
114
|
|
106
115
|
[project]
|
107
116
|
name = "crackerjack"
|
108
|
-
version = "0.
|
117
|
+
version = "0.11.0"
|
109
118
|
description = "Default template for PDM package"
|
110
119
|
requires-python = ">=3.13"
|
111
120
|
readme = "README.md"
|
@@ -132,17 +141,16 @@ classifiers = [
|
|
132
141
|
]
|
133
142
|
dependencies = [
|
134
143
|
"click>=8.1.8",
|
135
|
-
"aioconsole>=0.8.1",
|
136
|
-
"inflection>=0.5.1",
|
137
144
|
"autotyping>=24.9.0",
|
138
145
|
"pre-commit>=4.0.1",
|
139
146
|
"pytest>=8.3.4",
|
140
147
|
"pydantic>=2.10.4",
|
141
|
-
"aiopath>=0.7.7",
|
142
148
|
"pdm-bump>=0.9.10",
|
143
149
|
"pdm>=2.22.1",
|
144
|
-
"acb>=0.8.0",
|
145
150
|
"uv>=0.5.13",
|
151
|
+
"pytest-cov>=6.0.0",
|
152
|
+
"pytest-mock>=3.14.0",
|
153
|
+
"tomli-w>=1.2.0",
|
146
154
|
]
|
147
155
|
authors = [
|
148
156
|
{ name = "lesleslie", email = "les@wedgwoodwebworks.com" },
|
@@ -1,3 +1,6 @@
|
|
1
|
+
[tool.pytest.ini_options]
|
2
|
+
addopts = "--cov=crackerjack"
|
3
|
+
|
1
4
|
[tool.codespell]
|
2
5
|
skip = "*/data/*"
|
3
6
|
quiet-level = 3
|
@@ -9,6 +12,7 @@ target-version = "py313"
|
|
9
12
|
fix = true
|
10
13
|
show-fixes = true
|
11
14
|
output-format = "full"
|
15
|
+
unsafe-fixes = true
|
12
16
|
|
13
17
|
[tool.ruff.format]
|
14
18
|
docstring-code-format = true
|
@@ -59,6 +63,9 @@ exclude-deps = [
|
|
59
63
|
"autotyping",
|
60
64
|
"pre-commit",
|
61
65
|
"pytest",
|
66
|
+
"pytest-asyncio",
|
67
|
+
"pytest-cov",
|
68
|
+
"pytest-mock",
|
62
69
|
"pdm",
|
63
70
|
"pyfiglet",
|
64
71
|
"pyyaml",
|
@@ -74,6 +81,7 @@ target = [
|
|
74
81
|
"crackerjack",
|
75
82
|
]
|
76
83
|
skips = [
|
84
|
+
"B101",
|
77
85
|
"B301",
|
78
86
|
"B311",
|
79
87
|
"B403",
|
@@ -81,6 +89,7 @@ skips = [
|
|
81
89
|
"B602",
|
82
90
|
"B603",
|
83
91
|
"B607",
|
92
|
+
"B704",
|
84
93
|
]
|
85
94
|
|
86
95
|
[tool.pyright]
|
@@ -107,7 +116,7 @@ pythonPlatform = "Darwin"
|
|
107
116
|
|
108
117
|
[project]
|
109
118
|
name = "crackerjack"
|
110
|
-
version = "0.
|
119
|
+
version = "0.11.1"
|
111
120
|
description = "Default template for PDM package"
|
112
121
|
requires-python = ">=3.13"
|
113
122
|
readme = "README.md"
|
@@ -134,17 +143,16 @@ classifiers = [
|
|
134
143
|
]
|
135
144
|
dependencies = [
|
136
145
|
"click>=8.1.8",
|
137
|
-
"aioconsole>=0.8.1",
|
138
|
-
"inflection>=0.5.1",
|
139
146
|
"autotyping>=24.9.0",
|
140
147
|
"pre-commit>=4.0.1",
|
141
148
|
"pytest>=8.3.4",
|
142
149
|
"pydantic>=2.10.4",
|
143
|
-
"aiopath>=0.7.7",
|
144
150
|
"pdm-bump>=0.9.10",
|
145
151
|
"pdm>=2.22.1",
|
146
|
-
"acb>=0.8.0",
|
147
152
|
"uv>=0.5.13",
|
153
|
+
"pytest-cov>=6.0.0",
|
154
|
+
"pytest-mock>=3.14.0",
|
155
|
+
"tomli-w>=1.2.0",
|
148
156
|
]
|
149
157
|
authors = [
|
150
158
|
{ name = "lesleslie", email = "les@wedgwoodwebworks.com" },
|
File without changes
|
@@ -0,0 +1,145 @@
|
|
1
|
+
import typing as t
|
2
|
+
|
3
|
+
import pytest
|
4
|
+
from click.testing import CliRunner
|
5
|
+
from crackerjack.__main__ import crackerjack, options # Import crackerjack and options
|
6
|
+
from crackerjack.crackerjack import Crackerjack
|
7
|
+
|
8
|
+
|
9
|
+
# Mock crackerjack_it before test suite
|
10
|
+
@pytest.fixture(autouse=True)
|
11
|
+
def mock_crackerjack_it(monkeypatch: pytest.MonkeyPatch) -> None:
|
12
|
+
def mock_process(self: Crackerjack, options: t.Any) -> None:
|
13
|
+
"""Mock implementation for crackerjack_it process function."""
|
14
|
+
pass
|
15
|
+
|
16
|
+
monkeypatch.setattr(Crackerjack, "process", mock_process)
|
17
|
+
|
18
|
+
|
19
|
+
@pytest.fixture
|
20
|
+
def runner() -> CliRunner:
|
21
|
+
return CliRunner()
|
22
|
+
|
23
|
+
|
24
|
+
@pytest.fixture(autouse=True)
|
25
|
+
def reset_options() -> None:
|
26
|
+
"""Resets the options before each test."""
|
27
|
+
options.commit = False
|
28
|
+
options.interactive = False
|
29
|
+
options.doc = False
|
30
|
+
options.update_precommit = False
|
31
|
+
options.do_not_update_configs = False
|
32
|
+
options.publish = False
|
33
|
+
options.bump = False
|
34
|
+
options.verbose = False
|
35
|
+
|
36
|
+
|
37
|
+
def test_no_options(runner: CliRunner) -> None:
|
38
|
+
result = runner.invoke(crackerjack)
|
39
|
+
assert result.exit_code == 0
|
40
|
+
assert not options.commit
|
41
|
+
assert not options.interactive
|
42
|
+
assert not options.doc
|
43
|
+
assert not options.update_precommit
|
44
|
+
assert not options.do_not_update_configs
|
45
|
+
assert options.publish is False
|
46
|
+
assert options.bump is False
|
47
|
+
assert not options.verbose
|
48
|
+
|
49
|
+
|
50
|
+
def test_commit_option(runner: CliRunner) -> None:
|
51
|
+
result = runner.invoke(crackerjack, ["-c"])
|
52
|
+
assert result.exit_code == 1
|
53
|
+
assert options.commit
|
54
|
+
|
55
|
+
|
56
|
+
def test_interactive_option(runner: CliRunner) -> None:
|
57
|
+
result = runner.invoke(crackerjack, ["-i"])
|
58
|
+
assert result.exit_code == 0
|
59
|
+
assert options.interactive
|
60
|
+
|
61
|
+
|
62
|
+
def test_doc_option(runner: CliRunner) -> None:
|
63
|
+
result = runner.invoke(crackerjack, ["-d"])
|
64
|
+
assert result.exit_code == 0
|
65
|
+
assert options.doc
|
66
|
+
|
67
|
+
|
68
|
+
def test_update_precommit_option(runner: CliRunner) -> None:
|
69
|
+
result = runner.invoke(crackerjack, ["-u"])
|
70
|
+
assert result.exit_code == 0
|
71
|
+
assert options.update_precommit
|
72
|
+
|
73
|
+
|
74
|
+
def test_do_not_update_configs_option(runner: CliRunner) -> None:
|
75
|
+
result = runner.invoke(crackerjack, ["-x"])
|
76
|
+
assert result.exit_code == 0
|
77
|
+
assert options.do_not_update_configs
|
78
|
+
|
79
|
+
|
80
|
+
# def test_publish_micro_option(runner: CliRunner) -> None:
|
81
|
+
# result = runner.invoke(crackerjack, ["-p", "micro"])
|
82
|
+
# assert result.exit_code == 0
|
83
|
+
# assert options.publish == "micro"
|
84
|
+
#
|
85
|
+
#
|
86
|
+
# def test_publish_minor_option(runner: CliRunner) -> None:
|
87
|
+
# result = runner.invoke(crackerjack, ["-p", "minor"])
|
88
|
+
# assert result.exit_code == 0
|
89
|
+
# assert options.publish == "minor"
|
90
|
+
#
|
91
|
+
#
|
92
|
+
# def test_publish_major_option(runner: CliRunner) -> None:
|
93
|
+
# result = runner.invoke(crackerjack, ["-p", "major"])
|
94
|
+
# assert result.exit_code == 0
|
95
|
+
# assert options.publish == "major"
|
96
|
+
#
|
97
|
+
#
|
98
|
+
# def test_bump_micro_option(runner: CliRunner) -> None:
|
99
|
+
# result = runner.invoke(crackerjack, ["-b", "micro"])
|
100
|
+
# assert result.exit_code == 0
|
101
|
+
# assert options.bump == "micro"
|
102
|
+
#
|
103
|
+
#
|
104
|
+
# def test_bump_minor_option(runner: CliRunner) -> None:
|
105
|
+
# result = runner.invoke(crackerjack, ["-b", "minor"])
|
106
|
+
# assert result.exit_code == 0
|
107
|
+
# assert options.bump == "minor"
|
108
|
+
#
|
109
|
+
#
|
110
|
+
# def test_bump_major_option(runner: CliRunner) -> None:
|
111
|
+
# result = runner.invoke(crackerjack, ["-b", "major"])
|
112
|
+
# assert result.exit_code == 0
|
113
|
+
# assert options.bump == "major"
|
114
|
+
|
115
|
+
|
116
|
+
def test_verbose_option(runner: CliRunner) -> None:
|
117
|
+
result = runner.invoke(crackerjack, ["-v"])
|
118
|
+
assert result.exit_code == 0
|
119
|
+
assert options.verbose
|
120
|
+
assert "-v not currently implemented" in result.output
|
121
|
+
|
122
|
+
|
123
|
+
def test_multiple_options(runner: CliRunner) -> None:
|
124
|
+
result = runner.invoke(crackerjack, ["-c", "-i"])
|
125
|
+
assert result.exit_code == 1
|
126
|
+
assert options.commit
|
127
|
+
assert options.interactive
|
128
|
+
|
129
|
+
|
130
|
+
def test_help_option(runner: CliRunner) -> None:
|
131
|
+
result = runner.invoke(crackerjack, ["-h"])
|
132
|
+
assert result.exit_code == 0
|
133
|
+
assert "Usage: " in result.output
|
134
|
+
|
135
|
+
|
136
|
+
def test_invalid_publish_option(runner: CliRunner) -> None:
|
137
|
+
result = runner.invoke(crackerjack, ["-p", "invalid"])
|
138
|
+
assert result.exit_code == 0
|
139
|
+
assert options.publish is False
|
140
|
+
|
141
|
+
|
142
|
+
def test_invalid_bump_option(runner: CliRunner) -> None:
|
143
|
+
result = runner.invoke(crackerjack, ["-b", "invalid"])
|
144
|
+
assert result.exit_code == 0
|
145
|
+
assert options.bump is False
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.11/3256171999636029978
RENAMED
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.4/10355199064880463147
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.6/15140459877605758699
RENAMED
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.1.9/17041001205004563469
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.2.0/10047773857155985907
RENAMED
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.2.2/18053836298936336950
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.0/12548816621480535786
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.3/11081883392474770722
RENAMED
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.3.5/16311176246009842383
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.0/11982804814124138945
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.6.0/12055761203849489982
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.7.3/16061516852537040135
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.8.4/16354268377385700367
RENAMED
File without changes
|
{crackerjack-0.10.8 → crackerjack-0.11.1}/crackerjack/.ruff_cache/0.9.3/13948373885254993391
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|