Skip to content

Commit 4ac2334

Browse files
committed
Merge branch 'master' of github.com:tonybaloney/wily
2 parents ee7014a + a79b62e commit 4ac2334

File tree

5 files changed

+53
-64
lines changed

5 files changed

+53
-64
lines changed

.github/workflows/ci.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ jobs:
2424
- '3.9'
2525
- '3.10'
2626
- '3.11'
27-
continue-on-error:
28-
- false
27+
- '3.12'
2928
runs-on: "${{ matrix.os }}"
30-
continue-on-error: "${{ matrix.continue-on-error }}"
29+
continue-on-error: false
3130
steps:
3231
- uses: actions/checkout@v3
3332
- uses: actions/setup-python@v4

README.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
A command-line application for tracking, reporting on complexity of Python tests and applications.
44

55
[![Wily](https://img.shields.io/badge/%F0%9F%A6%8A%20wily-passing-brightgreen.svg)](https://wily.readthedocs.io/)
6-
[![codecov](https://codecov.io/gh/tonybaloney/wily/branch/master/graph/badge.svg)](https://codecov.io/gh/tonybaloney/wily) [![Documentation Status](https://readthedocs.org/projects/wily/badge/?version=latest)](https://wily.readthedocs.io/en/latest/?badge=latest) [![PyPI version](https://badge.fury.io/py/wily.svg)](https://badge.fury.io/py/wily) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/wily.svg)](https://anaconda.org/conda-forge/wily) ![black](https://img.shields.io/badge/code%20style-black-000000.svg)
6+
[![codecov](https://codecov.io/gh/tonybaloney/wily/branch/master/graph/badge.svg)](https://codecov.io/gh/tonybaloney/wily) [![Documentation Status](https://readthedocs.org/projects/wily/badge/?version=latest)](https://wily.readthedocs.io/en/latest/?badge=latest) [![PyPI version](https://badge.fury.io/py/wily.svg)](https://badge.fury.io/py/wily) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/wily.svg)](https://anaconda.org/conda-forge/wily) ![black](https://img.shields.io/badge/code%20style-black-000000.svg) ![PyPI - Downloads](https://img.shields.io/pypi/dm/wily)
77

8-
9-
```
8+
```default
109
wily [a]:
1110
quick to think of things, having a very good understanding of situations and possibilities,
1211
and often willing to use tricks to achieve an aim.
@@ -42,7 +41,7 @@ Wily can be used via a command line interface, `wily`.
4241

4342
## Demo
4443

45-
Here is a demo of wily analysing a Python project, giving a summary of changes to complexity in the last 10 commits and then showing changes against a specific git revision:
44+
Here is a demo of wily analysing a Python project, giving a summary of changes to complexity in the last 10 commits and then showing changes against a specific git revision:
4645

4746
![demo](./docs/source/_static/termtosvg_leo0ur6s.svg)
4847

@@ -86,7 +85,7 @@ repos:
8685

8786
The first step to using `wily` is to build a wily cache with the statistics of your project.
8887

89-
```
88+
```default
9089
Usage: __main__.py build [OPTIONS] [TARGETS]...
9190
9291
Build the wily cache
@@ -108,7 +107,6 @@ Limit the number of revisions (defaults to 50).
108107

109108
![wily-build](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_build.png)
110109

111-
112110
#### `wily report`
113111

114112
Show a specific metric for a given file, requires that `.wily/` exists
@@ -139,7 +137,6 @@ Show information about the build directory. Requires that `.wily/` exists.
139137

140138
![wily-graph](https://github.com/tonybaloney/wily/raw/master/docs/source/_static/wily_index.png)
141139

142-
143140
### `wily list-metrics`
144141

145142
List the metrics available in the Wily operators. Each one of the metrics can be used in `wily graph` and `wily report`
@@ -203,7 +200,6 @@ Wily will detect and scan all Python code in .ipynb files automatically.
203200
You can disable this behaviour if you require by setting `ipynb_support = false` in the configuration.
204201
You can also disable the behaviour of reporting on individual cells by setting `ipynb_cells = false`.
205202

206-
207203
# Credits
208204

209205
## Contributors

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ classifiers = [
1818
"Programming Language :: Python :: 3.9",
1919
"Programming Language :: Python :: 3.10",
2020
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
2122
"Programming Language :: Python :: 3 :: Only",
2223
]
2324
dependencies = [

test/integration/test_build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def test_build_crash(tmpdir):
8989
) as bar_finish:
9090
runner = CliRunner()
9191
result = runner.invoke(main.cli, ["--path", tmpdir, "build", "test.py"])
92-
assert bar_finish.called_once
92+
assert bar_finish.called
9393
assert result.exit_code == 1, result.stdout
9494

9595

test/unit/test_cli.py

+45-52
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@
88
from wily.helper.custom_enums import ReportFormat
99

1010

11-
def test_init():
12-
with patch.object(main, "cli", return_value=None) as cli:
13-
with patch.object(main, "__name__", "__main__"):
14-
__import__("wily.__main__")
15-
assert cli.called_once
16-
17-
1811
def test_help():
1912
"""
2013
Test that CLI when called with help options
@@ -33,7 +26,7 @@ def test_setup():
3326
runner = CliRunner()
3427
result = runner.invoke(main.cli, ["setup"])
3528
assert result.exit_code == 0
36-
assert handle_no_cache.called_once
29+
assert handle_no_cache.called
3730

3831

3932
def test_handle_no_cache_no():
@@ -43,7 +36,7 @@ def test_handle_no_cache_no():
4336
with patch("wily.__main__.input", return_value="n") as mock_input:
4437
with pytest.raises(SystemExit):
4538
main.handle_no_cache(None)
46-
assert mock_input.called_once
39+
assert mock_input.called
4740

4841

4942
def test_handle_no_cache():
@@ -55,8 +48,10 @@ def test_handle_no_cache():
5548
runner = CliRunner()
5649
runner.invoke(main.cli, ["setup"])
5750
assert mock_input.called
58-
assert build_command.called_once
59-
assert build_command.called_with("1")
51+
assert build_command.called
52+
build_command.assert_called_with(
53+
max_revisions=11, targets=["."], operators=None
54+
)
6055

6156

6257
def test_build():
@@ -67,7 +62,7 @@ def test_build():
6762
runner = CliRunner()
6863
result = runner.invoke(main.cli, ["build", "wily"])
6964
assert result.exit_code == 0
70-
assert build.called_once
65+
assert build.called
7166

7267

7368
def test_build_with_opts():
@@ -80,7 +75,7 @@ def test_build_with_opts():
8075
main.cli, ["build", "wily", "-n 1", "-o raw,maintainability"]
8176
)
8277
assert result.exit_code == 0
83-
assert build.called_once
78+
assert build.called
8479
assert build.call_args[1]["config"].max_revisions == 1
8580
assert build.call_args[1]["config"].operators == ["raw", "maintainability"]
8681

@@ -94,8 +89,8 @@ def test_index():
9489
runner = CliRunner()
9590
result = runner.invoke(main.cli, ["index"])
9691
assert result.exit_code == 0
97-
assert index.called_once
98-
assert check_cache.called_once
92+
assert index.called
93+
assert check_cache.called
9994

10095

10196
def test_index_with_opts():
@@ -107,8 +102,8 @@ def test_index_with_opts():
107102
runner = CliRunner()
108103
result = runner.invoke(main.cli, ["index", "--message"])
109104
assert result.exit_code == 0
110-
assert index.called_once
111-
assert check_cache.called_once
105+
assert index.called
106+
assert check_cache.called
112107
assert index.call_args[1]["include_message"]
113108

114109

@@ -121,8 +116,8 @@ def test_index_with_no_message():
121116
runner = CliRunner()
122117
result = runner.invoke(main.cli, ["index", "--no-message"])
123118
assert result.exit_code == 0
124-
assert index.called_once
125-
assert check_cache.called_once
119+
assert index.called
120+
assert check_cache.called
126121
assert not index.call_args[1]["include_message"]
127122

128123

@@ -139,12 +134,12 @@ def test_report():
139134
runner = CliRunner()
140135
result = runner.invoke(main.cli, ["report", "foo.py"])
141136
assert result.exit_code == 0, result.stdout
142-
assert report.called_once
143-
assert check_cache.called_once
137+
assert report.called
138+
assert check_cache.called
144139
assert report.call_args[1]["path"] == "foo.py"
145140
assert report.call_args[1]["format"] == ReportFormat.CONSOLE
146141
assert "maintainability.mi" in report.call_args[1]["metrics"]
147-
assert gdf.called_once
142+
assert gdf.called
148143

149144

150145
def test_report_with_opts():
@@ -158,8 +153,8 @@ def test_report_with_opts():
158153
main.cli, ["report", "foo.py", "example_metric", "-n 101", "--message"]
159154
)
160155
assert result.exit_code == 0, result.stdout
161-
assert report.called_once
162-
assert check_cache.called_once
156+
assert report.called
157+
assert check_cache.called
163158
assert report.call_args[1]["path"] == "foo.py"
164159
assert report.call_args[1]["metrics"] == ("example_metric",)
165160
assert report.call_args[1]["include_message"]
@@ -187,8 +182,8 @@ def test_report_html_format():
187182
)
188183

189184
assert result.exit_code == 0, result.stdout
190-
assert report.called_once
191-
assert check_cache.called_once
185+
assert report.called
186+
assert check_cache.called
192187
assert report.call_args[1]["path"] == "foo.py"
193188
assert report.call_args[1]["metrics"] == ("example_metric",)
194189
assert report.call_args[1]["include_message"]
@@ -215,8 +210,8 @@ def test_report_console_format():
215210
],
216211
)
217212
assert result.exit_code == 0, result.stdout
218-
assert report.called_once
219-
assert check_cache.called_once
213+
assert report.called
214+
assert check_cache.called
220215
assert report.call_args[1]["path"] == "foo.py"
221216
assert report.call_args[1]["metrics"] == ("example_metric",)
222217
assert report.call_args[1]["include_message"]
@@ -243,8 +238,6 @@ def test_report_not_existing_format():
243238
],
244239
)
245240
assert result.exit_code == 2, result.stdout
246-
assert report.called_once
247-
assert check_cache.called_once
248241

249242

250243
def test_report_html_format_with_output():
@@ -268,8 +261,8 @@ def test_report_html_format_with_output():
268261
)
269262

270263
assert result.exit_code == 0, result.stdout
271-
assert report.called_once
272-
assert check_cache.called_once
264+
assert report.called
265+
assert check_cache.called
273266
assert report.call_args[1]["path"] == "foo.py"
274267
assert report.call_args[1]["metrics"] == ("example_metric",)
275268
assert report.call_args[1]["include_message"]
@@ -291,8 +284,8 @@ def test_graph():
291284
main.cli, ["graph", "foo.py", "-m", "example_metric"]
292285
)
293286
assert result.exit_code == 0
294-
assert graph.called_once
295-
assert check_cache.called_once
287+
assert graph.called
288+
assert check_cache.called
296289
assert graph.call_args[1]["path"] == ("foo.py",)
297290
assert graph.call_args[1]["metrics"] == "example_metric"
298291

@@ -309,8 +302,8 @@ def test_graph_multiple_paths():
309302
["graph", "foo.py", "bar.py", "baz.py", "-m", "example_metric"],
310303
)
311304
assert result.exit_code == 0
312-
assert graph.called_once
313-
assert check_cache.called_once
305+
assert graph.called
306+
assert check_cache.called
314307
assert graph.call_args[1]["path"] == ("foo.py", "bar.py", "baz.py")
315308
assert graph.call_args[1]["metrics"] == "example_metric"
316309

@@ -326,8 +319,8 @@ def test_graph_multiple_metrics():
326319
main.cli, ["graph", "foo.py", "-m", "example_metric,another_metric"]
327320
)
328321
assert result.exit_code == 0
329-
assert graph.called_once
330-
assert check_cache.called_once
322+
assert graph.called
323+
assert check_cache.called
331324
assert graph.call_args[1]["path"] == ("foo.py",)
332325
assert graph.call_args[1]["metrics"] == "example_metric,another_metric"
333326

@@ -343,8 +336,8 @@ def test_graph_with_output():
343336
main.cli, ["graph", "foo.py", "-m", "example_metric", "-o", "foo.html"]
344337
)
345338
assert result.exit_code == 0
346-
assert graph.called_once
347-
assert check_cache.called_once
339+
assert graph.called
340+
assert check_cache.called
348341
assert graph.call_args[1]["path"] == ("foo.py",)
349342
assert graph.call_args[1]["metrics"] == "example_metric"
350343
assert graph.call_args[1]["output"] == "foo.html"
@@ -363,10 +356,10 @@ def test_diff():
363356
runner = CliRunner()
364357
result = runner.invoke(main.cli, ["diff", "foo.py", "x/b.py"])
365358
assert result.exit_code == 0
366-
assert diff.called_once
367-
assert check_cache.called_once
359+
assert diff.called
360+
assert check_cache.called
368361
assert diff.call_args[1]["files"] == ("foo.py", "x/b.py")
369-
assert gdf.called_once
362+
assert gdf.called
370363
assert "maintainability.mi" in diff.call_args[1]["metrics"]
371364

372365

@@ -392,8 +385,8 @@ def test_diff_with_metrics():
392385
],
393386
)
394387
assert result.exit_code == 0
395-
assert diff.called_once
396-
assert check_cache.called_once
388+
assert diff.called
389+
assert check_cache.called
397390
assert diff.call_args[1]["files"] == ("foo.py", "x/b.py")
398391
assert not gdf.called
399392
assert "maintainability.mi" in diff.call_args[1]["metrics"]
@@ -409,8 +402,8 @@ def test_clean():
409402
runner = CliRunner()
410403
result = runner.invoke(main.cli, ["clean", "--yes"])
411404
assert result.exit_code == 0
412-
assert clean.called_once
413-
assert check_cache.called_once
405+
assert clean.called
406+
assert check_cache.called
414407

415408

416409
def test_clean_with_prompt():
@@ -423,9 +416,9 @@ def test_clean_with_prompt():
423416
runner = CliRunner()
424417
result = runner.invoke(main.cli, ["clean"])
425418
assert result.exit_code == 0
426-
assert clean.called_once
427-
assert check_cache.called_once
428-
assert mock_input.called_once
419+
assert clean.called
420+
assert check_cache.called
421+
assert mock_input.called
429422

430423

431424
def test_clean_with_prompt_no_value():
@@ -439,5 +432,5 @@ def test_clean_with_prompt_no_value():
439432
result = runner.invoke(main.cli, ["clean"])
440433
assert result.exit_code == 0
441434
assert not clean.called
442-
assert check_cache.called_once
443-
assert mock_input.called_once
435+
assert check_cache.called
436+
assert mock_input.called

0 commit comments

Comments
 (0)