fast-dev-cli 0.9.6__tar.gz → 0.9.8__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.
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/PKG-INFO +1 -1
- fast_dev_cli-0.9.8/fast_dev_cli/__init__.py +1 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/fast_dev_cli/cli.py +11 -2
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/pyproject.toml +1 -1
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_lint.py +49 -11
- fast_dev_cli-0.9.6/fast_dev_cli/__init__.py +0 -1
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/LICENSE +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/README.md +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/fast_dev_cli/__main__.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/fast_dev_cli/py.typed +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/pdm_build.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/scripts/check.sh +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/scripts/format.sh +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/scripts/test.sh +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/__init__.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/conftest.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_bump.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_fast_test.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_functions.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_poetry_version_plugin.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_runserver.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_sync.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_tag.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_upgrade.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_upload.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/test_version.py +0 -0
- {fast_dev_cli-0.9.6 → fast_dev_cli-0.9.8}/tests/utils.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.9.8"
|
|
@@ -159,8 +159,9 @@ class BumpUp(DryRun):
|
|
|
159
159
|
If last commit message is startswith emoji,
|
|
160
160
|
add a ⬆️ flag at the prefix of bump up commit message.
|
|
161
161
|
"""
|
|
162
|
-
out
|
|
163
|
-
|
|
162
|
+
if out := cls.get_last_commit_message():
|
|
163
|
+
return emoji.is_emoji(out[0])
|
|
164
|
+
return False
|
|
164
165
|
|
|
165
166
|
@staticmethod
|
|
166
167
|
def parse_filename() -> str:
|
|
@@ -572,6 +573,12 @@ class LintCode(DryRun):
|
|
|
572
573
|
def check_lint_tool_installed() -> bool:
|
|
573
574
|
return check_call("ruff --version")
|
|
574
575
|
|
|
576
|
+
@staticmethod
|
|
577
|
+
def prefer_dmypy(paths: str, tools: list[str]) -> bool:
|
|
578
|
+
return (
|
|
579
|
+
paths == "." and tools[-1].startswith("mypy") and not load_bool("NO_DMYPY")
|
|
580
|
+
)
|
|
581
|
+
|
|
575
582
|
@classmethod
|
|
576
583
|
def to_cmd(cls: Type[Self], paths=".", check_only=False) -> str:
|
|
577
584
|
cmd = ""
|
|
@@ -599,6 +606,8 @@ class LintCode(DryRun):
|
|
|
599
606
|
should_run_by_tool = True
|
|
600
607
|
if should_run_by_tool:
|
|
601
608
|
prefix = Project.get_manage_tool() + " run "
|
|
609
|
+
if cls.prefer_dmypy(paths, tools):
|
|
610
|
+
tools[-1] = "dmypy run"
|
|
602
611
|
cmd += lint_them.format(prefix, paths, *tools)
|
|
603
612
|
return cmd
|
|
604
613
|
|
|
@@ -30,6 +30,16 @@ def mock_skip_mypy_0(monkeypatch):
|
|
|
30
30
|
monkeypatch.setenv("SKIP_MYPY", "0")
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
@pytest.fixture
|
|
34
|
+
def mock_no_dmypy(monkeypatch):
|
|
35
|
+
monkeypatch.setenv("NO_DMYPY", "1")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@pytest.fixture
|
|
39
|
+
def mock_no_dmypy_0(monkeypatch):
|
|
40
|
+
monkeypatch.setenv("NO_DMYPY", "0")
|
|
41
|
+
|
|
42
|
+
|
|
33
43
|
@pytest.fixture
|
|
34
44
|
def mock_ignore_missing_imports(monkeypatch):
|
|
35
45
|
monkeypatch.setenv("IGNORE_MISSING_IMPORTS", "1")
|
|
@@ -46,13 +56,28 @@ LINT_CMD = _CMD.format("", " --fix")
|
|
|
46
56
|
CHECK_CMD = _CMD.format(" --check", "")
|
|
47
57
|
|
|
48
58
|
|
|
49
|
-
def test_check():
|
|
59
|
+
def test_check(mock_no_dmypy):
|
|
50
60
|
command = capture_cmd_output("fast check --dry")
|
|
51
61
|
for cmd in CHECK_CMD.split(SEP):
|
|
52
62
|
assert cmd in command
|
|
53
63
|
|
|
54
64
|
|
|
55
|
-
def
|
|
65
|
+
def test_fast_check():
|
|
66
|
+
_fast_check()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def test_fast_check_0(mock_no_dmypy_0):
|
|
70
|
+
_fast_check()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _fast_check():
|
|
74
|
+
command = capture_cmd_output("fast check --dry")
|
|
75
|
+
expected = CHECK_CMD.replace("mypy", "dmypy run")
|
|
76
|
+
for cmd in expected.split(SEP):
|
|
77
|
+
assert cmd in command
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_lint_cmd(mock_no_dmypy):
|
|
56
81
|
run = "pdm run "
|
|
57
82
|
lint_cmd = f"{run}python fast_dev_cli/cli.py lint"
|
|
58
83
|
command = capture_cmd_output(f"{lint_cmd} . --dry")
|
|
@@ -70,7 +95,20 @@ def test_lint_cmd():
|
|
|
70
95
|
)
|
|
71
96
|
|
|
72
97
|
|
|
73
|
-
def
|
|
98
|
+
def test_dmypy_run(mocker):
|
|
99
|
+
mocker.patch("fast_dev_cli.cli.LintCode.prefer_dmypy", return_value=True)
|
|
100
|
+
command = capture_cmd_output("fast lint --dry .")
|
|
101
|
+
assert "dmypy run ." in command
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_lint_with_prefix(mocker):
|
|
105
|
+
mocker.patch("fast_dev_cli.cli.is_venv", return_value=False)
|
|
106
|
+
with capture_stdout() as stream:
|
|
107
|
+
make_style([Path(".")], check_only=False, dry=True)
|
|
108
|
+
assert "pdm run" in stream.getvalue()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def test_make_style(mocker, mock_no_dmypy):
|
|
74
112
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
75
113
|
with capture_stdout() as stream:
|
|
76
114
|
make_style([Path(".")], check_only=False, dry=True)
|
|
@@ -83,7 +121,7 @@ def test_make_style(mocker):
|
|
|
83
121
|
assert CHECK_CMD in stream.getvalue()
|
|
84
122
|
|
|
85
123
|
|
|
86
|
-
def test_lint_class(mocker):
|
|
124
|
+
def test_lint_class(mocker, mock_no_dmypy):
|
|
87
125
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
88
126
|
assert LintCode(".").gen() == LINT_CMD
|
|
89
127
|
check = LintCode(".", check_only=True)
|
|
@@ -92,7 +130,7 @@ def test_lint_class(mocker):
|
|
|
92
130
|
assert LintCode(".").gen() == LINT_CMD
|
|
93
131
|
|
|
94
132
|
|
|
95
|
-
def test_lint_func(mocker):
|
|
133
|
+
def test_lint_func(mocker, mock_no_dmypy):
|
|
96
134
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
97
135
|
with capture_stdout() as stream:
|
|
98
136
|
lint(".", dry=True)
|
|
@@ -102,7 +140,7 @@ def test_lint_func(mocker):
|
|
|
102
140
|
assert LINT_CMD.replace(" .", " tests") in stream.getvalue()
|
|
103
141
|
|
|
104
142
|
|
|
105
|
-
def test_lint_without_ruff_installed(mocker):
|
|
143
|
+
def test_lint_without_ruff_installed(mocker, mock_no_dmypy):
|
|
106
144
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
107
145
|
mocker.patch(
|
|
108
146
|
"fast_dev_cli.cli.LintCode.check_lint_tool_installed", return_value=False
|
|
@@ -117,7 +155,7 @@ def test_lint_without_ruff_installed(mocker):
|
|
|
117
155
|
assert f"{tip}:\n\n {cmd}" in output
|
|
118
156
|
|
|
119
157
|
|
|
120
|
-
def test_no_fix(mock_no_fix, mocker):
|
|
158
|
+
def test_no_fix(mock_no_fix, mocker, mock_no_dmypy):
|
|
121
159
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
122
160
|
assert LintCode(".").gen() == LINT_CMD.replace(" --fix", "")
|
|
123
161
|
|
|
@@ -128,24 +166,24 @@ def test_skip_mypy(mock_skip_mypy, mocker):
|
|
|
128
166
|
assert LintCode(".").gen() == SEP.join(i for i in cmds if not i.startswith("mypy"))
|
|
129
167
|
|
|
130
168
|
|
|
131
|
-
def test_skip_mypy_0(mock_skip_mypy_0, mocker):
|
|
169
|
+
def test_skip_mypy_0(mock_skip_mypy_0, mocker, mock_no_dmypy):
|
|
132
170
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
133
171
|
assert LintCode(".").gen() == LINT_CMD
|
|
134
172
|
|
|
135
173
|
|
|
136
|
-
def test_ignore_missing_imports(mock_ignore_missing_imports, mocker):
|
|
174
|
+
def test_ignore_missing_imports(mock_ignore_missing_imports, mocker, mock_no_dmypy):
|
|
137
175
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
138
176
|
assert LintCode(".").gen() == LINT_CMD.replace(
|
|
139
177
|
"mypy ", "mypy --ignore-missing-imports "
|
|
140
178
|
)
|
|
141
179
|
|
|
142
180
|
|
|
143
|
-
def test_ignore_missing_imports_0(mock_ignore_missing_imports_0, mocker):
|
|
181
|
+
def test_ignore_missing_imports_0(mock_ignore_missing_imports_0, mocker, mock_no_dmypy):
|
|
144
182
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
145
183
|
assert LintCode(".").gen() == LINT_CMD
|
|
146
184
|
|
|
147
185
|
|
|
148
|
-
def test_not_in_root(mocker):
|
|
186
|
+
def test_not_in_root(mocker, mock_no_dmypy):
|
|
149
187
|
mocker.patch("fast_dev_cli.cli.is_venv", return_value=True)
|
|
150
188
|
root = Path(__file__).parent.parent
|
|
151
189
|
with chdir(root / "fast_dev_cli"):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.9.6"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|