diff-cover 10.2.0__tar.gz → 10.2.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.
Files changed (159) hide show
  1. {diff_cover-10.2.0 → diff_cover-10.2.1}/PKG-INFO +1 -1
  2. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/diff_cover_tool.py +1 -1
  3. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/git_diff.py +2 -6
  4. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/violationsreporters/violations_reporter.py +1 -1
  5. {diff_cover-10.2.0 → diff_cover-10.2.1}/pyproject.toml +4 -4
  6. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_diff_reporter.py +16 -32
  7. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_integration.py +9 -16
  8. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_java_violations_reporter.py +18 -66
  9. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_report_generator.py +16 -32
  10. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_violations_reporter.py +42 -164
  11. {diff_cover-10.2.0 → diff_cover-10.2.1}/LICENSE +0 -0
  12. {diff_cover-10.2.0 → diff_cover-10.2.1}/NOTICE +0 -0
  13. {diff_cover-10.2.0 → diff_cover-10.2.1}/README.rst +0 -0
  14. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/__init__.py +0 -0
  15. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/command_runner.py +0 -0
  16. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/config_parser.py +0 -0
  17. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/diff_quality_tool.py +0 -0
  18. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/diff_reporter.py +0 -0
  19. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/git_path.py +0 -0
  20. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/hook.py +0 -0
  21. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/hookspecs.py +0 -0
  22. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/report_generator.py +0 -0
  23. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/snippets.py +0 -0
  24. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/console_coverage_report.txt +0 -0
  25. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/console_quality_report.txt +0 -0
  26. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/external_style.css +0 -0
  27. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/github_coverage_annotations.txt +0 -0
  28. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/html_coverage_report.html +0 -0
  29. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/html_quality_report.html +0 -0
  30. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/markdown_coverage_report.md +0 -0
  31. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/markdown_quality_report.md +0 -0
  32. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/snippet_content.html +0 -0
  33. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/snippet_content.md +0 -0
  34. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/snippet_content.txt +0 -0
  35. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/templates/snippet_style.html +0 -0
  36. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/util.py +0 -0
  37. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/violationsreporters/__init__.py +0 -0
  38. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/violationsreporters/base.py +0 -0
  39. {diff_cover-10.2.0 → diff_cover-10.2.1}/diff_cover/violationsreporters/java_violations_reporter.py +0 -0
  40. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/__init__.py +0 -0
  41. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/conftest.py +0 -0
  42. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/add_console_report.txt +0 -0
  43. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/add_html_report.html +0 -0
  44. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/add_json_report.json +0 -0
  45. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/add_json_report_float.json +0 -0
  46. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/add_markdown_report.md +0 -0
  47. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/changed_console_report.txt +0 -0
  48. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/changed_html_report.html +0 -0
  49. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/coverage.xml +0 -0
  50. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/coverage1.xml +0 -0
  51. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/coverage2.xml +0 -0
  52. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/coverage_missing_lines.xml +0 -0
  53. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/cpp_functions_console_report.txt +0 -0
  54. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/cpp_functions_coverage.lcov +0 -0
  55. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/delete_console_report.txt +0 -0
  56. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/delete_html_report.html +0 -0
  57. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/dotnet_coverage.xml +0 -0
  58. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/empty.txt +0 -0
  59. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/empty_pycodestyle_violations.txt +0 -0
  60. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/expand_console_report.txt +0 -0
  61. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/external_css_html_report.html +0 -0
  62. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/external_style.css +0 -0
  63. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_add.txt +0 -0
  64. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_changed.txt +0 -0
  65. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_code_dupe.txt +0 -0
  66. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_cpp.txt +0 -0
  67. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_cpp_functions.txt +0 -0
  68. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_delete.txt +0 -0
  69. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_dotnet.txt +0 -0
  70. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_external_css.txt +0 -0
  71. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_lua.txt +0 -0
  72. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_moved.txt +0 -0
  73. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_mult.txt +0 -0
  74. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_python.txt +0 -0
  75. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_subdir.txt +0 -0
  76. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_typescript.txt +0 -0
  77. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_typescript_branches.txt +0 -0
  78. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_unicode.txt +0 -0
  79. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_violations.txt +0 -0
  80. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/git_diff_violations_two_files.txt +0 -0
  81. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/hello.py +0 -0
  82. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/hi.py +0 -0
  83. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/html_report.html +0 -0
  84. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/html_report_empty.html +0 -0
  85. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/html_report_one_snippet.html +0 -0
  86. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/html_report_two_snippets.html +0 -0
  87. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/lcov.info +0 -0
  88. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/lua_console_report.txt +0 -0
  89. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/luacoverage.xml +0 -0
  90. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/markdown_report_one_snippet.md +0 -0
  91. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/markdown_report_two_snippets.md +0 -0
  92. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/moved_console_report.txt +0 -0
  93. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/moved_coverage.xml +0 -0
  94. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/moved_html_report.html +0 -0
  95. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/mult_inputs_console_report.txt +0 -0
  96. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/mult_inputs_html_report.html +0 -0
  97. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_report.txt +0 -0
  98. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report.html +0 -0
  99. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report.json +0 -0
  100. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report.md +0 -0
  101. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report.txt +0 -0
  102. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report_external_css.html +0 -0
  103. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pycodestyle_violations_report_float.json +0 -0
  104. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pyflakes_two_files.txt +0 -0
  105. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pyflakes_violations_report.html +0 -0
  106. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pyflakes_violations_report.txt +0 -0
  107. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_dupe.txt +0 -0
  108. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_dupe_violations_report.txt +0 -0
  109. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_report.txt +0 -0
  110. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_violations_console_report.txt +0 -0
  111. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_violations_report.html +0 -0
  112. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylint_violations_report.txt +0 -0
  113. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/pylintrc +0 -0
  114. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_cpp_console_report.txt +0 -0
  115. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_cpp_coverage.lcov +0 -0
  116. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_python_console_report.txt +0 -0
  117. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_python_coverage.lcov +0 -0
  118. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_typescript_console_report.txt +0 -0
  119. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/real_typescript_coverage.lcov +0 -0
  120. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/show_uncovered_lines_console.txt +0 -0
  121. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet.css +0 -0
  122. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_8859.py +0 -0
  123. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_arabic_output.html +0 -0
  124. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_default.html +0 -0
  125. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_invalid_violations.html +0 -0
  126. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_list.html +0 -0
  127. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_list.md +0 -0
  128. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_list2.md +0 -0
  129. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_list3.md +0 -0
  130. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_no_filename_ext.html +0 -0
  131. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_src.py +0 -0
  132. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_src2.cpp +0 -0
  133. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_src3.cpp +0 -0
  134. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_unicode.html +0 -0
  135. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_unicode.py +0 -0
  136. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/snippet_unicode_html_output.html +0 -0
  137. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/subdir_coverage_console_report.txt +0 -0
  138. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/subdir_coverage_html_report.html +0 -0
  139. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/test_src.txt +0 -0
  140. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/typescript_branches_console_report.txt +0 -0
  141. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/typescript_branches_coverage.lcov +0 -0
  142. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/unicode_console_report.txt +0 -0
  143. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/unicode_coverage.xml +0 -0
  144. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/unicode_html_report.html +0 -0
  145. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/unicode_test_src.txt +0 -0
  146. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/fixtures/violations_test_file.py +0 -0
  147. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/helpers.py +0 -0
  148. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/snippet_list_unicode.html +0 -0
  149. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_clover_violations_reporter/test.xml +0 -0
  150. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_clover_violations_reporter.py +0 -0
  151. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_config_parser.py +0 -0
  152. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_diff_cover_main.py +0 -0
  153. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_diff_cover_tool.py +0 -0
  154. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_diff_quality_main.py +0 -0
  155. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_git_diff.py +0 -0
  156. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_git_diff_file.py +0 -0
  157. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_git_path.py +0 -0
  158. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_snippets.py +0 -0
  159. {diff_cover-10.2.0 → diff_cover-10.2.1}/tests/test_util.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: diff_cover
3
- Version: 10.2.0
3
+ Version: 10.2.1
4
4
  Summary: Run coverage and linting reports on diffs
5
5
  License: Apache-2.0
6
6
  Author: See Contributors
@@ -312,7 +312,7 @@ def generate_coverage_report(
312
312
 
313
313
 
314
314
  def handle_old_format(description, argv):
315
- parser = argparse.ArgumentParser(description=description)
315
+ parser = argparse.ArgumentParser(description=description, add_help=False)
316
316
  arg_html = parser.add_argument("--html-report", type=str)
317
317
  arg_json = parser.add_argument("--json-report", type=str)
318
318
  arg_markdown = parser.add_argument("--markdown-report", type=str)
@@ -72,14 +72,10 @@ class GitDiffTool:
72
72
  )[0]
73
73
  except CommandError as e:
74
74
  if "unknown revision" in str(e):
75
- raise ValueError(
76
- dedent(
77
- f"""
75
+ raise ValueError(dedent(f"""
78
76
  Could not find the branch to compare to. Does '{compare_branch}' exist?
79
77
  the `--compare-branch` argument allows you to set a different branch.
80
- """
81
- )
82
- ) from e
78
+ """)) from e
83
79
  raise
84
80
 
85
81
  def diff_unstaged(self):
@@ -831,7 +831,7 @@ class CppcheckDriver(QualityDriver):
831
831
  # Ignore any line that isn't matched
832
832
  # (for example, snippets from the source code)
833
833
  if match is not None:
834
- (cppcheck_src_path, line_number, message) = match.groups()
834
+ cppcheck_src_path, line_number, message = match.groups()
835
835
 
836
836
  violation = Violation(int(line_number), message)
837
837
  violations_dict[util.to_unix_path(cppcheck_src_path)].append(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "diff_cover"
3
- version = "10.2.0"
3
+ version = "10.2.1"
4
4
  description = "Run coverage and linting reports on diffs"
5
5
  authors = ["See Contributors"]
6
6
  homepage = "https://github.com/Bachmann1234/diff-cover"
@@ -58,10 +58,10 @@ pyflakes = "^3.3.2"
58
58
  pylint = ">=3.3.4,<5.0.0"
59
59
  pylint-pytest = "^1.1.8"
60
60
  pydocstyle = "^6.1.1"
61
- black = "^25.1.0"
62
- isort = "^6.0.1"
61
+ black = "^26.1.0"
62
+ isort = ">=6.0.1,<9.0.0"
63
63
  doc8 = "2.0.0"
64
- ruff = ">=0.11.10,<0.15.0"
64
+ ruff = ">=0.11.10,<0.16.0"
65
65
 
66
66
  [tool.poetry.extras]
67
67
  toml = ["tomli"]
@@ -246,8 +246,7 @@ def test_ignore_lines_outside_src(diff, git_diff):
246
246
  def test_one_line_file(diff, git_diff):
247
247
  # Files with only one line have a special format
248
248
  # in which the "length" part of the hunk is not specified
249
- diff_str = dedent(
250
- """
249
+ diff_str = dedent("""
251
250
  diff --git a/diff_cover/one_line.txt b/diff_cover/one_line.txt
252
251
  index 0867e73..9daeafb 100644
253
252
  --- a/diff_cover/one_line.txt
@@ -256,8 +255,7 @@ def test_one_line_file(diff, git_diff):
256
255
  test
257
256
  -test
258
257
  -test
259
- """
260
- ).strip()
258
+ """).strip()
261
259
 
262
260
  # Configure the git diff output
263
261
  _set_git_diff_output(diff, git_diff, diff_str, "", "")
@@ -291,8 +289,7 @@ def test_git_deleted_lines(diff, git_diff):
291
289
  def test_git_unicode_filename(diff, git_diff):
292
290
  # Filenames with unicode characters have double quotes surrounding them
293
291
  # in the git diff output.
294
- diff_str = dedent(
295
- """
292
+ diff_str = dedent("""
296
293
  diff --git "a/unic\303\270\342\210\202e\314\201.txt" "b/unic\303\270\342\210\202e\314\201.txt"
297
294
  new file mode 100644
298
295
  index 0000000..248ebea
@@ -302,8 +299,7 @@ def test_git_unicode_filename(diff, git_diff):
302
299
  +μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος
303
300
  +οὐλομένην, ἣ μυρί᾽ Ἀχαιοῖς ἄλγε᾽ ἔθηκε,
304
301
  +πολλὰς δ᾽ ἰφθίμους ψυχὰς Ἄϊδι προΐαψεν
305
- """
306
- ).strip()
302
+ """).strip()
307
303
 
308
304
  _set_git_diff_output(diff, git_diff, diff_str, "", "")
309
305
  # Get the lines changed in the diff
@@ -429,28 +425,22 @@ def test_git_diff_error(
429
425
  diff,
430
426
  git_diff,
431
427
  ):
432
- invalid_hunk_str = dedent(
433
- """
428
+ invalid_hunk_str = dedent("""
434
429
  diff --git a/subdir/file1.py b/subdir/file1.py
435
430
  @@ invalid @@ Text
436
- """
437
- ).strip()
431
+ """).strip()
438
432
 
439
433
  no_src_line_str = "@@ -33,10 +34,13 @@ Text"
440
434
 
441
- non_numeric_lines = dedent(
442
- """
435
+ non_numeric_lines = dedent("""
443
436
  diff --git a/subdir/file1.py b/subdir/file1.py
444
437
  @@ -1,2 +a,b @@
445
- """
446
- ).strip()
438
+ """).strip()
447
439
 
448
- missing_line_num = dedent(
449
- """
440
+ missing_line_num = dedent("""
450
441
  diff --git a/subdir/file1.py b/subdir/file1.py
451
442
  @@ -1,2 + @@
452
- """
453
- ).strip()
443
+ """).strip()
454
444
 
455
445
  missing_src_str = "diff --git "
456
446
 
@@ -478,16 +468,14 @@ def test_git_diff_error(
478
468
 
479
469
  def test_plus_sign_in_hunk_bug(diff, git_diff):
480
470
  # This was a bug that caused a parse error
481
- diff_str = dedent(
482
- """
471
+ diff_str = dedent("""
483
472
  diff --git a/file.py b/file.py
484
473
  @@ -16,16 +16,7 @@ 1 + 2
485
474
  + test
486
475
  + test
487
476
  + test
488
477
  + test
489
- """
490
- )
478
+ """)
491
479
 
492
480
  _set_git_diff_output(diff, git_diff, diff_str, "", "")
493
481
 
@@ -498,16 +486,14 @@ def test_plus_sign_in_hunk_bug(diff, git_diff):
498
486
  def test_terminating_chars_in_hunk(diff, git_diff):
499
487
  # Check what happens when there's an @@ symbol after the
500
488
  # first terminating @@ symbol
501
- diff_str = dedent(
502
- """
489
+ diff_str = dedent("""
503
490
  diff --git a/file.py b/file.py
504
491
  @@ -16,16 +16,7 @@ and another +23,2 @@ symbol
505
492
  + test
506
493
  + test
507
494
  + test
508
495
  + test
509
- """
510
- )
496
+ """)
511
497
 
512
498
  _set_git_diff_output(diff, git_diff, diff_str, "", "")
513
499
 
@@ -518,8 +504,7 @@ def test_terminating_chars_in_hunk(diff, git_diff):
518
504
  def test_merge_conflict_diff(diff, git_diff):
519
505
  # Handle different git diff format when in the middle
520
506
  # of a merge conflict
521
- diff_str = dedent(
522
- """
507
+ diff_str = dedent("""
523
508
  diff --cc subdir/src.py
524
509
  index d2034c0,e594d54..0000000
525
510
  diff --cc subdir/src.py
@@ -531,8 +516,7 @@ def test_merge_conflict_diff(diff, git_diff):
531
516
  ++<<<<<< HEAD
532
517
  + test
533
518
  ++=======
534
- """
535
- )
519
+ """)
536
520
 
537
521
  _set_git_diff_output(diff, git_diff, diff_str, "", "")
538
522
 
@@ -2,6 +2,7 @@
2
2
  # pylint: disable=use-implicit-booleaness-not-comparison
3
3
 
4
4
  """High-level integration tests of diff-cover tool."""
5
+
5
6
  import json
6
7
  import os
7
8
  import os.path
@@ -383,8 +384,7 @@ class TestDiffCoverIntegration:
383
384
  mocker.patch.object(GitPathTool, "_git_root", return_value="/code/samplediff/")
384
385
  patch_git_command.set_stdout("git_diff_dotnet.txt")
385
386
  assert runbin(["dotnet_coverage.xml"]) == 0
386
- expected = textwrap.dedent(
387
- f"""\
387
+ expected = textwrap.dedent(f"""\
388
388
  -------------
389
389
  Diff Coverage
390
390
  Diff: origin/main...HEAD, staged and unstaged changes
@@ -395,8 +395,7 @@ class TestDiffCoverIntegration:
395
395
  Missing: 3 lines
396
396
  Coverage: 0%
397
397
  -------------
398
- """
399
- )
398
+ """)
400
399
  assert capsys.readouterr().out.strip() == expected.strip()
401
400
 
402
401
  def test_unicode_html(self, runbin, patch_git_command):
@@ -469,22 +468,19 @@ class TestDiffCoverIntegration:
469
468
  assert (
470
469
  runbin(["coverage.xml", "--format", "github-annotations:notice", "-q"]) == 0
471
470
  )
472
- expected = textwrap.dedent(
473
- """\
471
+ expected = textwrap.dedent("""\
474
472
  ::notice file=test_src.txt,line=2,title=Missing Coverage::Line 2 missing coverage
475
473
  ::notice file=test_src.txt,line=4,title=Missing Coverage::Line 4 missing coverage
476
474
  ::notice file=test_src.txt,line=6,title=Missing Coverage::Line 6 missing coverage
477
475
  ::notice file=test_src.txt,line=8,title=Missing Coverage::Line 8 missing coverage
478
476
  ::notice file=test_src.txt,line=10,title=Missing Coverage::Line 10 missing coverage
479
- """
480
- )
477
+ """)
481
478
  assert capsys.readouterr().out == expected
482
479
 
483
480
  @pytest.mark.usefixtures("patch_git_command")
484
481
  def test_github_fully_covered(self, runbin, capsys):
485
482
  assert runbin(["coverage2.xml", "--format", "github-annotations:notice"]) == 0
486
- expected = textwrap.dedent(
487
- """\
483
+ expected = textwrap.dedent("""\
488
484
  -------------
489
485
  Diff Coverage
490
486
  Diff: origin/main...HEAD, staged and unstaged changes
@@ -492,15 +488,13 @@ class TestDiffCoverIntegration:
492
488
  No lines with coverage information in this diff.
493
489
  -------------
494
490
 
495
- """
496
- )
491
+ """)
497
492
  assert capsys.readouterr().out == expected
498
493
 
499
494
  def test_github_empty_diff(self, runbin, patch_git_command, capsys):
500
495
  patch_git_command.set_stdout("")
501
496
  assert runbin(["coverage.xml", "--format", "github-annotations:notice"]) == 0
502
- expected = textwrap.dedent(
503
- """\
497
+ expected = textwrap.dedent("""\
504
498
  -------------
505
499
  Diff Coverage
506
500
  Diff: origin/main...HEAD, staged and unstaged changes
@@ -508,8 +502,7 @@ class TestDiffCoverIntegration:
508
502
  No lines with coverage information in this diff.
509
503
  -------------
510
504
 
511
- """
512
- )
505
+ """)
513
506
  assert capsys.readouterr().out == expected
514
507
 
515
508
  def test_real_world_cpp_lcov_coverage(self, runbin, patch_git_command, capsys):
@@ -62,14 +62,10 @@ class TestCheckstyleQualityReporterTest:
62
62
  # Patch the output of `checkstyle`
63
63
  process_patcher(
64
64
  (
65
- dedent(
66
- """
65
+ dedent("""
67
66
  [WARN] ../new_file.java:1:1: Line contains a tab character.
68
67
  [WARN] ../new_file.java:13: 'if' construct must use '{}'s.
69
- """
70
- )
71
- .strip()
72
- .encode("ascii"),
68
+ """).strip().encode("ascii"),
73
69
  "",
74
70
  )
75
71
  )
@@ -127,8 +123,7 @@ class TestCheckstyleXmlQualityReporterTest:
127
123
  # Patch the output of `checkstyle`
128
124
  process_patcher(
129
125
  (
130
- dedent(
131
- """
126
+ dedent("""
132
127
  <?xml version="1.0" encoding="UTF-8"?>
133
128
  <checkstyle version="8.0">
134
129
  <file name="file1.java">
@@ -144,10 +139,7 @@ class TestCheckstyleXmlQualityReporterTest:
144
139
  <error line="100" severity="error" message="Access to a protected member"/>
145
140
  </file>
146
141
  </checkstyle>
147
- """
148
- )
149
- .strip()
150
- .encode("ascii"),
142
+ """).strip().encode("ascii"),
151
143
  "",
152
144
  )
153
145
  )
@@ -187,16 +179,14 @@ class TestCheckstyleXmlQualityReporterTest:
187
179
  # Patch the output stderr/stdout and returncode of `checkstyle`
188
180
  process_patcher(
189
181
  (
190
- dedent(
191
- """
182
+ dedent("""
192
183
  <?xml version="1.0" encoding="UTF-8"?>
193
184
  <checkstyle version="8.0">
194
185
  <file name="file1.java">
195
186
  <error line="1" severity="error" message="Missing docstring"/>
196
187
  </file>
197
188
  </checkstyle>
198
- """
199
- ),
189
+ """),
200
190
  b"oops",
201
191
  ),
202
192
  status_code=1,
@@ -216,9 +206,7 @@ class TestCheckstyleXmlQualityReporterTest:
216
206
  # When the user provides us with a pre-generated checkstyle report
217
207
  # then use that instead of calling checkstyle directly.
218
208
  checkstyle_reports = [
219
- BytesIO(
220
- dedent(
221
- """
209
+ BytesIO(dedent("""
222
210
  <?xml version="1.0" encoding="UTF-8"?>
223
211
  <checkstyle version="8.0">
224
212
  <file name="path/to/file.java">
@@ -231,14 +219,8 @@ class TestCheckstyleXmlQualityReporterTest:
231
219
  <error line="259" severity="error" message="Invalid name '' for type variable (should match [a-z_][a-z0-9_]{2,30}$)"/>
232
220
  </file>
233
221
  </checkstyle>
234
- """
235
- )
236
- .strip()
237
- .encode("utf-8")
238
- ),
239
- BytesIO(
240
- dedent(
241
- """
222
+ """).strip().encode("utf-8")),
223
+ BytesIO(dedent("""
242
224
  <?xml version="1.0" encoding="UTF-8"?>
243
225
  <checkstyle version="8.0">
244
226
  <file name="path/to/file.java">
@@ -248,11 +230,7 @@ class TestCheckstyleXmlQualityReporterTest:
248
230
  <error line="183" severity="error" message="Missing docstring"/>
249
231
  </file>
250
232
  </checkstyle>
251
- """
252
- )
253
- .strip()
254
- .encode("utf-8")
255
- ),
233
+ """).strip().encode("utf-8")),
256
234
  ]
257
235
 
258
236
  # Generate the violation report
@@ -307,9 +285,7 @@ class TestFindbugsQualityReporterTest:
307
285
  # When the user provides us with a pre-generated findbugs report
308
286
  # then use that instead of calling findbugs directly.
309
287
  findbugs_reports = [
310
- BytesIO(
311
- dedent(
312
- """
288
+ BytesIO(dedent("""
313
289
  <?xml version="1.0" encoding="UTF-8"?>
314
290
  <BugCollection sequence="0" release="" analysisTimestamp="1512755361404" version="3.0.1" timestamp="1512755226000">
315
291
  <BugInstance instanceOccurrenceNum="0" instanceHash="1967bf8c4d25c6b964f30356014aa9fb" rank="20" abbrev="Dm" category="I18N" priority="3" type="DM_CONVERT_CASE" instanceOccurrenceMax="0">
@@ -333,14 +309,8 @@ class TestFindbugsQualityReporterTest:
333
309
  </SourceLine>
334
310
  </BugInstance>
335
311
  </BugCollection>
336
- """
337
- )
338
- .strip()
339
- .encode("utf-8")
340
- ),
341
- BytesIO(
342
- dedent(
343
- """
312
+ """).strip().encode("utf-8")),
313
+ BytesIO(dedent("""
344
314
  <?xml version="1.0" encoding="UTF-8"?>
345
315
  <BugCollection sequence="0" release="" analysisTimestamp="1512755361404" version="3.0.1" timestamp="1512755226000">
346
316
  <BugInstance instanceOccurrenceNum="0" instanceHash="1967bf8c4d25c6b964f30356014aa9fb" rank="20" abbrev="Dm" category="I18N" priority="3" type="DM_CONVERT_CASE" instanceOccurrenceMax="0">
@@ -364,15 +334,9 @@ class TestFindbugsQualityReporterTest:
364
334
  </SourceLine>
365
335
  </BugInstance>
366
336
  </BugCollection>
367
- """
368
- )
369
- .strip()
370
- .encode("utf-8")
371
- ),
337
+ """).strip().encode("utf-8")),
372
338
  # this is a violation which is not bounded to a specific line. We'll skip those
373
- BytesIO(
374
- dedent(
375
- """
339
+ BytesIO(dedent("""
376
340
  <?xml version="1.0" encoding="UTF-8"?>
377
341
  <BugCollection sequence="0" release="" analysisTimestamp="1512755361404" version="3.0.1" timestamp="1512755226000">
378
342
  <BugInstance instanceOccurrenceNum="0" instanceHash="2820338ec68e2e75a81848c95d31167f" rank="19" abbrev="Se" category="BAD_PRACTICE" priority="3" type="SE_BAD_FIELD" instanceOccurrenceMax="0">
@@ -383,11 +347,7 @@ class TestFindbugsQualityReporterTest:
383
347
  </SourceLine>
384
348
  </BugInstance>
385
349
  </BugCollection>
386
- """
387
- )
388
- .strip()
389
- .encode("utf-8")
390
- ),
350
+ """).strip().encode("utf-8")),
391
351
  ]
392
352
 
393
353
  # Generate the violation report
@@ -441,10 +401,7 @@ class TestPmdXmlQualityReporterTest:
441
401
  def test_quality_pregenerated_report(self):
442
402
  # When the user provides us with a pre-generated findbugs report
443
403
  # then use that instead of calling findbugs directly.
444
- pmd_reports = [
445
- BytesIO(
446
- dedent(
447
- """
404
+ pmd_reports = [BytesIO(dedent("""
448
405
  <?xml version="1.0" encoding="UTF-8"?>
449
406
  <pmd version="5.6.1" timestamp="2019-06-24T15:47:13.429">
450
407
  <file name="path/to/file.java">
@@ -458,12 +415,7 @@ class TestPmdXmlQualityReporterTest:
458
415
  </violation>
459
416
  </file>
460
417
  </pmd>
461
- """
462
- )
463
- .strip()
464
- .encode("utf-8")
465
- )
466
- ]
418
+ """).strip().encode("utf-8"))]
467
419
 
468
420
  pmd_xml_driver = PmdXmlDriver()
469
421
  # Generate the violation report
@@ -368,8 +368,7 @@ class TestStringReportGenerator(BaseReportGeneratorTest):
368
368
  @pytest.mark.usefixtures("use_default_values")
369
369
  def test_generate_report(self):
370
370
  # Verify that we got the expected string
371
- expected = dedent(
372
- """
371
+ expected = dedent("""
373
372
  -------------
374
373
  Diff Coverage
375
374
  Diff: main
@@ -381,8 +380,7 @@ class TestStringReportGenerator(BaseReportGeneratorTest):
381
380
  Missing: 4 lines
382
381
  Coverage: 66%
383
382
  -------------
384
- """
385
- ).strip()
383
+ """).strip()
386
384
 
387
385
  self.assert_report(expected)
388
386
 
@@ -395,8 +393,7 @@ class TestStringReportGenerator(BaseReportGeneratorTest):
395
393
  coverage_violations.update({"file.py": []})
396
394
  coverage_measured_lines.update({"file.py": [2]})
397
395
 
398
- expected = dedent(
399
- """
396
+ expected = dedent("""
400
397
  -------------
401
398
  Diff Coverage
402
399
  Diff: main
@@ -407,8 +404,7 @@ class TestStringReportGenerator(BaseReportGeneratorTest):
407
404
  Missing: 0 lines
408
405
  Coverage: 100%
409
406
  -------------
410
- """
411
- ).strip()
407
+ """).strip()
412
408
 
413
409
  self.assert_report(expected)
414
410
 
@@ -416,16 +412,14 @@ class TestStringReportGenerator(BaseReportGeneratorTest):
416
412
  # Have the dependencies return an empty report
417
413
  # (this is the default)
418
414
 
419
- expected = dedent(
420
- """
415
+ expected = dedent("""
421
416
  -------------
422
417
  Diff Coverage
423
418
  Diff: main
424
419
  -------------
425
420
  No lines with coverage information in this diff.
426
421
  -------------
427
- """
428
- ).strip()
422
+ """).strip()
429
423
 
430
424
  self.assert_report(expected)
431
425
 
@@ -448,12 +442,10 @@ class TestGitHubAnnotationsReportGenerator(BaseReportGeneratorTest):
448
442
  @pytest.mark.usefixtures("use_default_values")
449
443
  def test_generate_report(self):
450
444
  # Verify that we got the expected string
451
- expected = dedent(
452
- """
445
+ expected = dedent("""
453
446
  ::warning file=file1.py,line=10,endLine=11,title=Missing Coverage::Line 10-11 missing coverage
454
447
  ::warning file=subdir/file2.py,line=10,endLine=11,title=Missing Coverage::Line 10-11 missing coverage
455
- """
456
- ).strip()
448
+ """).strip()
457
449
 
458
450
  self.assert_report(expected)
459
451
 
@@ -466,11 +458,9 @@ class TestGitHubAnnotationsReportGenerator(BaseReportGeneratorTest):
466
458
  coverage_measured_lines.update({"file.py": [2]})
467
459
 
468
460
  # Verify that we got the expected string
469
- expected = dedent(
470
- """
461
+ expected = dedent("""
471
462
  ::warning file=file.py,line=10,title=Missing Coverage::Line 10 missing coverage
472
- """
473
- ).strip()
463
+ """).strip()
474
464
 
475
465
  self.assert_report(expected)
476
466
 
@@ -549,8 +539,7 @@ class TestMarkdownReportGenerator(BaseReportGeneratorTest):
549
539
  # Generate a default report
550
540
 
551
541
  # Verify that we got the expected string
552
- expected = dedent(
553
- """
542
+ expected = dedent("""
554
543
  # Diff Coverage
555
544
  ## Diff: main
556
545
 
@@ -562,8 +551,7 @@ class TestMarkdownReportGenerator(BaseReportGeneratorTest):
562
551
  - **Total**: 12 lines
563
552
  - **Missing**: 4 lines
564
553
  - **Coverage**: 66%
565
- """
566
- ).strip()
554
+ """).strip()
567
555
 
568
556
  self.assert_report(expected)
569
557
 
@@ -576,8 +564,7 @@ class TestMarkdownReportGenerator(BaseReportGeneratorTest):
576
564
  coverage_violations.update({"file.py": []})
577
565
  coverage_measured_lines.update({"file.py": [2]})
578
566
 
579
- expected = dedent(
580
- """
567
+ expected = dedent("""
581
568
  # Diff Coverage
582
569
  ## Diff: main
583
570
 
@@ -588,8 +575,7 @@ class TestMarkdownReportGenerator(BaseReportGeneratorTest):
588
575
  - **Total**: 1 line
589
576
  - **Missing**: 0 lines
590
577
  - **Coverage**: 100%
591
- """
592
- ).strip()
578
+ """).strip()
593
579
 
594
580
  self.assert_report(expected)
595
581
 
@@ -597,14 +583,12 @@ class TestMarkdownReportGenerator(BaseReportGeneratorTest):
597
583
  # Have the dependencies return an empty report
598
584
  # (this is the default)
599
585
 
600
- expected = dedent(
601
- """
586
+ expected = dedent("""
602
587
  # Diff Coverage
603
588
  ## Diff: main
604
589
 
605
590
  No lines with coverage information in this diff.
606
- """
607
- ).strip()
591
+ """).strip()
608
592
 
609
593
  self.assert_report(expected)
610
594