diff-cover 9.7.2__tar.gz → 10.0.0__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 (156) hide show
  1. {diff_cover-9.7.2 → diff_cover-10.0.0}/PKG-INFO +2 -1
  2. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/config_parser.py +20 -0
  3. {diff_cover-9.7.2 → diff_cover-10.0.0}/pyproject.toml +4 -4
  4. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_config_parser.py +83 -0
  5. {diff_cover-9.7.2 → diff_cover-10.0.0}/LICENSE +0 -0
  6. {diff_cover-9.7.2 → diff_cover-10.0.0}/NOTICE +0 -0
  7. {diff_cover-9.7.2 → diff_cover-10.0.0}/README.rst +0 -0
  8. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/__init__.py +0 -0
  9. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/command_runner.py +0 -0
  10. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/diff_cover_tool.py +0 -0
  11. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/diff_quality_tool.py +0 -0
  12. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/diff_reporter.py +0 -0
  13. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/git_diff.py +0 -0
  14. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/git_path.py +0 -0
  15. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/hook.py +0 -0
  16. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/hookspecs.py +0 -0
  17. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/report_generator.py +0 -0
  18. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/snippets.py +0 -0
  19. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/console_coverage_report.txt +0 -0
  20. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/console_quality_report.txt +0 -0
  21. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/external_style.css +0 -0
  22. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/github_coverage_annotations.txt +0 -0
  23. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/html_coverage_report.html +0 -0
  24. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/html_quality_report.html +0 -0
  25. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/markdown_coverage_report.md +0 -0
  26. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/markdown_quality_report.md +0 -0
  27. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/snippet_content.html +0 -0
  28. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/snippet_content.md +0 -0
  29. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/snippet_content.txt +0 -0
  30. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/templates/snippet_style.html +0 -0
  31. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/util.py +0 -0
  32. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/violationsreporters/__init__.py +0 -0
  33. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/violationsreporters/base.py +0 -0
  34. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/violationsreporters/java_violations_reporter.py +0 -0
  35. {diff_cover-9.7.2 → diff_cover-10.0.0}/diff_cover/violationsreporters/violations_reporter.py +0 -0
  36. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/__init__.py +0 -0
  37. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/add_console_report.txt +0 -0
  38. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/add_html_report.html +0 -0
  39. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/add_json_report.json +0 -0
  40. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/add_markdown_report.md +0 -0
  41. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/changed_console_report.txt +0 -0
  42. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/changed_html_report.html +0 -0
  43. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/coverage.xml +0 -0
  44. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/coverage1.xml +0 -0
  45. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/coverage2.xml +0 -0
  46. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/coverage_missing_lines.xml +0 -0
  47. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/cpp_functions_console_report.txt +0 -0
  48. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/cpp_functions_coverage.lcov +0 -0
  49. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/delete_console_report.txt +0 -0
  50. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/delete_html_report.html +0 -0
  51. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/dotnet_coverage.xml +0 -0
  52. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/empty.txt +0 -0
  53. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/empty_pycodestyle_violations.txt +0 -0
  54. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/expand_console_report.txt +0 -0
  55. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/external_css_html_report.html +0 -0
  56. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/external_style.css +0 -0
  57. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_add.txt +0 -0
  58. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_changed.txt +0 -0
  59. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_code_dupe.txt +0 -0
  60. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_cpp.txt +0 -0
  61. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_cpp_functions.txt +0 -0
  62. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_delete.txt +0 -0
  63. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_dotnet.txt +0 -0
  64. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_external_css.txt +0 -0
  65. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_lua.txt +0 -0
  66. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_moved.txt +0 -0
  67. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_mult.txt +0 -0
  68. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_python.txt +0 -0
  69. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_subdir.txt +0 -0
  70. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_typescript.txt +0 -0
  71. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_typescript_branches.txt +0 -0
  72. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_unicode.txt +0 -0
  73. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_violations.txt +0 -0
  74. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/git_diff_violations_two_files.txt +0 -0
  75. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/hello.py +0 -0
  76. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/hi.py +0 -0
  77. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/html_report.html +0 -0
  78. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/html_report_empty.html +0 -0
  79. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/html_report_one_snippet.html +0 -0
  80. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/html_report_two_snippets.html +0 -0
  81. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/lcov.info +0 -0
  82. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/lua_console_report.txt +0 -0
  83. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/luacoverage.xml +0 -0
  84. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/markdown_report_one_snippet.md +0 -0
  85. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/markdown_report_two_snippets.md +0 -0
  86. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/moved_console_report.txt +0 -0
  87. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/moved_coverage.xml +0 -0
  88. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/moved_html_report.html +0 -0
  89. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/mult_inputs_console_report.txt +0 -0
  90. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/mult_inputs_html_report.html +0 -0
  91. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_report.txt +0 -0
  92. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_violations_report.html +0 -0
  93. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_violations_report.json +0 -0
  94. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_violations_report.md +0 -0
  95. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_violations_report.txt +0 -0
  96. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pycodestyle_violations_report_external_css.html +0 -0
  97. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pyflakes_two_files.txt +0 -0
  98. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pyflakes_violations_report.html +0 -0
  99. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pyflakes_violations_report.txt +0 -0
  100. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_dupe.txt +0 -0
  101. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_dupe_violations_report.txt +0 -0
  102. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_report.txt +0 -0
  103. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_violations_console_report.txt +0 -0
  104. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_violations_report.html +0 -0
  105. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylint_violations_report.txt +0 -0
  106. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/pylintrc +0 -0
  107. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_cpp_console_report.txt +0 -0
  108. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_cpp_coverage.lcov +0 -0
  109. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_python_console_report.txt +0 -0
  110. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_python_coverage.lcov +0 -0
  111. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_typescript_console_report.txt +0 -0
  112. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/real_typescript_coverage.lcov +0 -0
  113. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/show_uncovered_lines_console.txt +0 -0
  114. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet.css +0 -0
  115. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_8859.py +0 -0
  116. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_arabic_output.html +0 -0
  117. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_default.html +0 -0
  118. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_invalid_violations.html +0 -0
  119. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_list.html +0 -0
  120. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_list.md +0 -0
  121. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_list2.md +0 -0
  122. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_list3.md +0 -0
  123. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_no_filename_ext.html +0 -0
  124. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_src.py +0 -0
  125. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_src2.cpp +0 -0
  126. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_src3.cpp +0 -0
  127. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_unicode.html +0 -0
  128. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_unicode.py +0 -0
  129. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/snippet_unicode_html_output.html +0 -0
  130. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/subdir_coverage_console_report.txt +0 -0
  131. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/subdir_coverage_html_report.html +0 -0
  132. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/test_src.txt +0 -0
  133. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/typescript_branches_console_report.txt +0 -0
  134. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/typescript_branches_coverage.lcov +0 -0
  135. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/unicode_console_report.txt +0 -0
  136. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/unicode_coverage.xml +0 -0
  137. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/unicode_html_report.html +0 -0
  138. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/unicode_test_src.txt +0 -0
  139. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/fixtures/violations_test_file.py +0 -0
  140. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/helpers.py +0 -0
  141. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/snippet_list_unicode.html +0 -0
  142. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_clover_violations_reporter/test.xml +0 -0
  143. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_clover_violations_reporter.py +0 -0
  144. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_diff_cover_main.py +0 -0
  145. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_diff_cover_tool.py +0 -0
  146. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_diff_quality_main.py +0 -0
  147. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_diff_reporter.py +0 -0
  148. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_git_diff.py +0 -0
  149. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_git_diff_file.py +0 -0
  150. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_git_path.py +0 -0
  151. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_integration.py +0 -0
  152. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_java_violations_reporter.py +0 -0
  153. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_report_generator.py +0 -0
  154. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_snippets.py +0 -0
  155. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_util.py +0 -0
  156. {diff_cover-9.7.2 → diff_cover-10.0.0}/tests/test_violations_reporter.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: diff_cover
3
- Version: 9.7.2
3
+ Version: 10.0.0
4
4
  Summary: Run coverage and linting reports on diffs
5
5
  License: Apache-2.0
6
6
  Author: See Contributors
@@ -17,6 +17,7 @@ Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
18
  Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Programming Language :: Python :: 3.14
20
21
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
22
  Classifier: Topic :: Software Development :: Quality Assurance
22
23
  Classifier: Topic :: Software Development :: Testing
@@ -67,6 +67,20 @@ def _parse_config_file(file_name, tool):
67
67
  raise ParserError(f"No config parser could handle {file_name}")
68
68
 
69
69
 
70
+ def _normalize_patterns(patterns):
71
+ """
72
+ Normalize exclude/include patterns to always be a list.
73
+
74
+ :param patterns: Pattern(s) from config (None, str, or list)
75
+ :returns: Normalized list or None
76
+ """
77
+ if patterns is None:
78
+ return None
79
+ if isinstance(patterns, str):
80
+ return [patterns]
81
+ return patterns
82
+
83
+
70
84
  def get_config(parser, argv, defaults, tool):
71
85
  cli_config = vars(parser.parse_args(argv))
72
86
  if cli_config["config_file"]:
@@ -84,4 +98,10 @@ def get_config(parser, argv, defaults, tool):
84
98
  # else just override the existing value
85
99
  config[key] = value
86
100
 
101
+ # Normalize exclude and include patterns to always be lists
102
+ if "exclude" in config:
103
+ config["exclude"] = _normalize_patterns(config["exclude"])
104
+ if "include" in config:
105
+ config["include"] = _normalize_patterns(config["include"])
106
+
87
107
  return config
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "diff_cover"
3
- version = "9.7.2"
3
+ version = "10.0.0"
4
4
  description = "Run coverage and linting reports on diffs"
5
5
  authors = ["See Contributors"]
6
6
  homepage = "https://github.com/Bachmann1234/diff-cover"
@@ -15,11 +15,11 @@ classifiers=[
15
15
  "Operating System :: OS Independent",
16
16
  "Programming Language :: Python",
17
17
  "Programming Language :: Python :: 3",
18
- "Programming Language :: Python :: 3.9",
19
18
  "Programming Language :: Python :: 3.10",
20
19
  "Programming Language :: Python :: 3.11",
21
20
  "Programming Language :: Python :: 3.12",
22
21
  "Programming Language :: Python :: 3.13",
22
+ "Programming Language :: Python :: 3.14",
23
23
  "Programming Language :: Python :: Implementation :: CPython",
24
24
  "Topic :: Software Development :: Testing",
25
25
  "Topic :: Software Development :: Quality Assurance",
@@ -48,7 +48,7 @@ chardet = ">=3.0.0"
48
48
  tomli = {version = ">=1.2.1", optional = true}
49
49
 
50
50
  [tool.poetry.group.dev.dependencies]
51
- pytest-cov = "^6.1.1"
51
+ pytest-cov = ">=6.1.1,<8.0.0"
52
52
  pytest-datadir = "^1.5.0"
53
53
  pytest-mock = "^3.14.0"
54
54
  pytest-xdist = "^3.6.1"
@@ -61,7 +61,7 @@ pydocstyle = "^6.1.1"
61
61
  black = "^25.1.0"
62
62
  isort = "^6.0.1"
63
63
  doc8 = "1.1.2"
64
- ruff = ">=0.11.10,<0.13.0"
64
+ ruff = ">=0.11.10,<0.15.0"
65
65
 
66
66
  [tool.poetry.extras]
67
67
  toml = ["tomli"]
@@ -98,3 +98,86 @@ def test_get_config(
98
98
  parser = mocker.Mock()
99
99
  parser.parse_args().__dict__ = cli_config
100
100
  assert get_config(parser, argv=[], defaults=defaults, tool=tool) == expected
101
+
102
+
103
+ @pytest.mark.parametrize(
104
+ "tool,content,expected_exclude",
105
+ [
106
+ (Tool.DIFF_COVER, '[tool.diff_cover]\nexclude="*.pyc"', ["*.pyc"]),
107
+ (Tool.DIFF_QUALITY, '[tool.diff_quality]\nexclude="*.pyc"', ["*.pyc"]),
108
+ ],
109
+ )
110
+ def test_normalize_exclude_string(mocker, tmp_path, tool, content, expected_exclude):
111
+ """String exclude from TOML should be normalized to list."""
112
+ toml_file = tmp_path / "foo.toml"
113
+ toml_file.write_text(content)
114
+
115
+ cli_config = {"config_file": str(toml_file), "exclude": None}
116
+ parser = mocker.Mock()
117
+ parser.parse_args().__dict__ = cli_config
118
+
119
+ result = get_config(parser, argv=[], defaults={}, tool=tool)
120
+ assert result["exclude"] == expected_exclude
121
+
122
+
123
+ @pytest.mark.parametrize(
124
+ "tool,content,expected_exclude",
125
+ [
126
+ (
127
+ Tool.DIFF_COVER,
128
+ '[tool.diff_cover]\nexclude=["*.pyc", "*.pyo"]',
129
+ ["*.pyc", "*.pyo"],
130
+ ),
131
+ (
132
+ Tool.DIFF_QUALITY,
133
+ '[tool.diff_quality]\nexclude=["*.pyc", "*.pyo"]',
134
+ ["*.pyc", "*.pyo"],
135
+ ),
136
+ ],
137
+ )
138
+ def test_exclude_list_unchanged(mocker, tmp_path, tool, content, expected_exclude):
139
+ """List exclude from TOML should remain as list."""
140
+ toml_file = tmp_path / "foo.toml"
141
+ toml_file.write_text(content)
142
+
143
+ cli_config = {"config_file": str(toml_file), "exclude": None}
144
+ parser = mocker.Mock()
145
+ parser.parse_args().__dict__ = cli_config
146
+
147
+ result = get_config(parser, argv=[], defaults={}, tool=tool)
148
+ assert result["exclude"] == expected_exclude
149
+
150
+
151
+ @pytest.mark.parametrize(
152
+ "tool,content,expected_include",
153
+ [
154
+ (Tool.DIFF_COVER, '[tool.diff_cover]\ninclude="src/**"', ["src/**"]),
155
+ (Tool.DIFF_QUALITY, '[tool.diff_quality]\ninclude="src/**"', ["src/**"]),
156
+ ],
157
+ )
158
+ def test_normalize_include_string(mocker, tmp_path, tool, content, expected_include):
159
+ """String include from TOML should be normalized to list."""
160
+ toml_file = tmp_path / "foo.toml"
161
+ toml_file.write_text(content)
162
+
163
+ cli_config = {"config_file": str(toml_file), "include": None}
164
+ parser = mocker.Mock()
165
+ parser.parse_args().__dict__ = cli_config
166
+
167
+ result = get_config(parser, argv=[], defaults={}, tool=tool)
168
+ assert result["include"] == expected_include
169
+
170
+
171
+ def test_get_config_normalizes_both_patterns(mocker, tmp_path):
172
+ """get_config should normalize both exclude and include from TOML files."""
173
+ toml_file = tmp_path / "foo.toml"
174
+ toml_file.write_text('[tool.diff_cover]\nexclude="*.pyc"\ninclude="src/**"')
175
+
176
+ cli_config = {"config_file": str(toml_file), "exclude": None, "include": None}
177
+ parser = mocker.Mock()
178
+ parser.parse_args().__dict__ = cli_config
179
+
180
+ result = get_config(parser, argv=[], defaults={}, tool=Tool.DIFF_COVER)
181
+
182
+ assert result["exclude"] == ["*.pyc"]
183
+ assert result["include"] == ["src/**"]
File without changes
File without changes
File without changes
File without changes