File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ releases are available on [PyPI](https://pypi.org/project/pytask) and
1111- {pull}` 277 ` ignores ` DeprecationWarning ` and ` PendingDeprecationWarning ` by default.
1212 Previously, they were enabled, but they should be shown when testing the project with
1313 pytest, not after the execution with pytask. Fixes {issue}` 269 ` .
14+ - {pull}` 278 ` counts multiple occurrences of a warning instead of listing the module or
15+ task name again and again. Fixes {issue}` 270 ` .
1416
1517## 0.2.2 - 2022-05-14
1618
Original file line number Diff line number Diff line change @@ -155,3 +155,24 @@ def warn_now():
155155 assert result .returncode == ExitCode .OK
156156 assert "Warnings" not in result .stdout .decode ()
157157 assert "warning!!!" not in result .stdout .decode ()
158+
159+
160+ def test_multiple_occurrences_of_warning (tmp_path , runner ):
161+ source = """
162+ import warnings
163+ import pytask
164+
165+ for i in range(10):
166+
167+ @pytask.mark.task
168+ def task_example():
169+ warnings.warn("warning!!!")
170+ """
171+ tmp_path .joinpath ("task_example.py" ).write_text (textwrap .dedent (source ))
172+
173+ result = runner .invoke (cli , [tmp_path .as_posix ()])
174+
175+ assert result .exit_code == ExitCode .OK
176+ assert "Warnings" in result .output
177+ assert "warning!!!" in result .output
178+ assert result .output .count ("task_example" ) == 41
You can’t perform that action at this time.
0 commit comments