github2gerrit 0.1.4__tar.gz → 0.1.6__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 (72) hide show
  1. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.editorconfig +3 -3
  2. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.pre-commit-config.yaml +2 -0
  3. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.yamllint +2 -0
  4. {github2gerrit-0.1.4/src/github2gerrit.egg-info → github2gerrit-0.1.6}/PKG-INFO +24 -25
  5. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/README.md +21 -24
  6. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/action.yaml +31 -18
  7. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/pyproject.toml +22 -5
  8. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/sitecustomize.py +7 -2
  9. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/cli.py +196 -108
  10. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/config.py +207 -5
  11. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/core.py +542 -398
  12. github2gerrit-0.1.6/src/github2gerrit/duplicate_detection.py +724 -0
  13. github2gerrit-0.1.6/src/github2gerrit/gerrit_urls.py +256 -0
  14. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/github_api.py +15 -20
  15. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/gitutils.py +49 -13
  16. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/models.py +1 -0
  17. github2gerrit-0.1.6/src/github2gerrit/similarity.py +458 -0
  18. github2gerrit-0.1.6/src/github2gerrit/ssh_discovery.py +365 -0
  19. {github2gerrit-0.1.4 → github2gerrit-0.1.6/src/github2gerrit.egg-info}/PKG-INFO +24 -25
  20. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/SOURCES.txt +7 -0
  21. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/requires.txt +2 -0
  22. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/conftest.py +3 -10
  23. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/fixtures/make_repo.py +15 -12
  24. github2gerrit-0.1.6/tests/test_cli.py +259 -0
  25. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_cli_helpers.py +18 -13
  26. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_cli_outputs_file.py +5 -16
  27. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_cli_url_and_dryrun.py +3 -9
  28. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_config_and_reviewers.py +1 -3
  29. github2gerrit-0.1.6/tests/test_config_helpers.py +634 -0
  30. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_close_pr_policy.py +7 -21
  31. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_config_and_errors.py +28 -49
  32. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_gerrit_backref_comment.py +30 -33
  33. github2gerrit-0.1.6/tests/test_core_gerrit_push_errors.py +471 -0
  34. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_gerrit_rest_results.py +15 -47
  35. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_integration_fixture_repo.py +2 -6
  36. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_prepare_commits.py +17 -53
  37. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_core_ssh_setup.py +195 -29
  38. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_duplicate_detection.py +75 -118
  39. github2gerrit-0.1.6/tests/test_gerrit_change_id_footer.py +154 -0
  40. github2gerrit-0.1.6/tests/test_gerrit_urls.py +336 -0
  41. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_ghe_and_gitreview_args.py +4 -14
  42. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_github_api_helpers.py +1 -4
  43. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_gitutils_helpers.py +9 -30
  44. github2gerrit-0.1.6/tests/test_ssh_discovery.py +343 -0
  45. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_url_parser.py +15 -5
  46. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/uv.lock +298 -15
  47. github2gerrit-0.1.4/src/github2gerrit/duplicate_detection.py +0 -542
  48. github2gerrit-0.1.4/tests/test_cli.py +0 -137
  49. github2gerrit-0.1.4/tests/test_config_helpers.py +0 -271
  50. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/actionlint.yaml +0 -0
  51. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/dependabot.yml +0 -0
  52. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/release-drafter.yml +0 -0
  53. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/build-test-release.yaml +0 -0
  54. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/build-test.yaml +0 -0
  55. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/dependencies.yaml +0 -0
  56. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/github2gerrit.yaml +0 -0
  57. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/release-drafter.yaml +0 -0
  58. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/semantic-pull-request.yaml +0 -0
  59. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.github/workflows/sha-pinned-actions.yaml +0 -0
  60. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.gitignore +0 -0
  61. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.gitlint +0 -0
  62. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/.readthedocs.yml +0 -0
  63. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/LICENSE +0 -0
  64. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/LICENSES/Apache-2.0.txt +0 -0
  65. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/REUSE.toml +0 -0
  66. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/setup.cfg +0 -0
  67. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit/__init__.py +0 -0
  68. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/dependency_links.txt +0 -0
  69. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/entry_points.txt +0 -0
  70. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/src/github2gerrit.egg-info/top_level.txt +0 -0
  71. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/fixtures/__init__.py +0 -0
  72. {github2gerrit-0.1.4 → github2gerrit-0.1.6}/tests/test_github_api_retry_and_helpers.py +0 -0
@@ -14,10 +14,10 @@ indent_size = 4
14
14
  indent_size = 2
15
15
 
16
16
  [*.markdown]
17
- max_line_length = 80
17
+ max_line_length = 120
18
18
 
19
19
  [*.py]
20
- max_line_legth = 120
20
+ max_line_length = 120
21
21
 
22
22
  [*.sh]
23
- max_line_length = 80
23
+ max_line_length = 120
@@ -79,6 +79,7 @@ repos:
79
79
  hooks:
80
80
  - id: write-good
81
81
  files: "\\.(rst|md|markdown|mdown|mkdn)$"
82
+ exclude: "GERRIT_URL_CENTRALIZATION.md"
82
83
 
83
84
  - repo: https://github.com/shellcheck-py/shellcheck-py
84
85
  rev: 745eface02aef23e168a8afb6b5737818efbea95 # frozen: v0.11.0.1
@@ -90,6 +91,7 @@ repos:
90
91
  hooks:
91
92
  - id: markdownlint
92
93
  args: ["--fix"]
94
+ exclude: "GERRIT_URL_CENTRALIZATION.md"
93
95
 
94
96
  - repo: https://github.com/fsfe/reuse-tool
95
97
  rev: 60dfc6b2ad9e1f3eabfbcf3a0dc202ee89dc5a00 # frozen: v5.0.2
@@ -11,3 +11,5 @@ rules:
11
11
  # prettier forces 1 space comment separator
12
12
  min-spaces-from-content: 1
13
13
  level: error
14
+ line-length:
15
+ max: 120
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: github2gerrit
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Submit a GitHub pull request to a Gerrit repository.
5
5
  Author-email: Matthew Watkins <mwatkins@linuxfoundation.org>
6
6
  License-Expression: Apache-2.0
@@ -34,6 +34,8 @@ Requires-Dist: ruff>=0.6.3; extra == "dev"
34
34
  Requires-Dist: black>=24.8.0; extra == "dev"
35
35
  Requires-Dist: mypy>=1.11.2; extra == "dev"
36
36
  Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
37
+ Requires-Dist: types-requests>=2.31.0; extra == "dev"
38
+ Requires-Dist: types-click>=7.1.8; extra == "dev"
37
39
  Dynamic: license-file
38
40
 
39
41
  <!--
@@ -103,16 +105,25 @@ stabilize coverage reporting for parallel/xdist runs.
103
105
 
104
106
  ## Duplicate detection
105
107
 
106
- By default, the tool checks for duplicate changes to prevent spam
107
- submissions from automated tools like Dependabot. It compares PR titles,
108
- content, and files changed against recent PRs (last 7 days) and will
109
- exit with an error when it finds duplicates.
108
+ Duplicate detection uses a scoring-based approach. Instead of relying on a hash
109
+ added by this action, the detector compares the first line of the commit message
110
+ (subject/PR title), analyzes the body text and the set of files changed, and
111
+ computes a similarity score. When the score meets or exceeds a configurable
112
+ threshold (default 0.8), the tool treats the change as a duplicate and blocks
113
+ submission. This approach aims to remain robust even when similar changes
114
+ appeared outside this pipeline.
110
115
 
111
116
  ### Examples of detected duplicates
112
117
 
113
- - Identical Dependabot PRs: "Bump package from 1.0 to 1.1"
114
- - Sequential dependency updates: "Bump package 1.01.1", "Bump package 1.11.2"
115
- - Similar bug fixes with slightly different wording
118
+ - Dependency bumps for the same package across close versions
119
+ (e.g., "Bump foo from 1.0 to 1.1" vs "Bump foo from 1.1 to 1.2")
120
+ with overlapping files high score
121
+ - Pre-commit autoupdates that change .pre-commit-config.yaml and hook versions —
122
+ high score
123
+ - GitHub Actions version bumps that update .github/workflows/* uses lines —
124
+ medium to high score
125
+ - Similar bug fixes with the same subject and significant file overlap —
126
+ strong match
116
127
 
117
128
  ### Allowing duplicates
118
129
 
@@ -288,19 +299,7 @@ jobs:
288
299
  submit-to-gerrit:
289
300
  runs-on: ubuntu-latest
290
301
  steps:
291
- - name: Install SSH key and custom SSH config
292
- <!-- markdownlint-disable-next-line MD013 -->
293
- uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
294
- with:
295
- key: ${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}
296
- name: "id_rsa"
297
- known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
298
- config: |
299
- Host ${{ vars.GERRIT_SERVER }}
300
- User ${{ vars.GERRIT_SSH_USER_G2G }}
301
- Port ${{ vars.GERRIT_SERVER_PORT }}
302
- PubkeyAcceptedKeyTypes +ssh-rsa
303
- IdentityFile ~/.ssh/id_rsa
302
+
304
303
 
305
304
  - name: Submit PR to Gerrit (with explicit overrides)
306
305
  id: g2g
@@ -334,10 +333,10 @@ jobs:
334
333
 
335
334
  Notes:
336
335
 
337
- - If both this step and the action define SSH configuration, the last
338
- configuration applied in the runner wins.
339
- - For most users, you can rely on the action’s built-in SSH setup. Use this
340
- advanced configuration when you need custom SSH behavior or hosts.
336
+ - The action configures SSH internally using the provided inputs (key,
337
+ known_hosts) and does not use the runner’s SSH agent or ~/.ssh/config.
338
+ - Do not add external steps to install SSH keys or edit SSH config; they’re
339
+ unnecessary and may conflict with the action.
341
340
 
342
341
  ## GitHub Enterprise support
343
342
 
@@ -65,16 +65,25 @@ stabilize coverage reporting for parallel/xdist runs.
65
65
 
66
66
  ## Duplicate detection
67
67
 
68
- By default, the tool checks for duplicate changes to prevent spam
69
- submissions from automated tools like Dependabot. It compares PR titles,
70
- content, and files changed against recent PRs (last 7 days) and will
71
- exit with an error when it finds duplicates.
68
+ Duplicate detection uses a scoring-based approach. Instead of relying on a hash
69
+ added by this action, the detector compares the first line of the commit message
70
+ (subject/PR title), analyzes the body text and the set of files changed, and
71
+ computes a similarity score. When the score meets or exceeds a configurable
72
+ threshold (default 0.8), the tool treats the change as a duplicate and blocks
73
+ submission. This approach aims to remain robust even when similar changes
74
+ appeared outside this pipeline.
72
75
 
73
76
  ### Examples of detected duplicates
74
77
 
75
- - Identical Dependabot PRs: "Bump package from 1.0 to 1.1"
76
- - Sequential dependency updates: "Bump package 1.01.1", "Bump package 1.11.2"
77
- - Similar bug fixes with slightly different wording
78
+ - Dependency bumps for the same package across close versions
79
+ (e.g., "Bump foo from 1.0 to 1.1" vs "Bump foo from 1.1 to 1.2")
80
+ with overlapping files high score
81
+ - Pre-commit autoupdates that change .pre-commit-config.yaml and hook versions —
82
+ high score
83
+ - GitHub Actions version bumps that update .github/workflows/* uses lines —
84
+ medium to high score
85
+ - Similar bug fixes with the same subject and significant file overlap —
86
+ strong match
78
87
 
79
88
  ### Allowing duplicates
80
89
 
@@ -250,19 +259,7 @@ jobs:
250
259
  submit-to-gerrit:
251
260
  runs-on: ubuntu-latest
252
261
  steps:
253
- - name: Install SSH key and custom SSH config
254
- <!-- markdownlint-disable-next-line MD013 -->
255
- uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
256
- with:
257
- key: ${{ secrets.GERRIT_SSH_PRIVKEY_G2G }}
258
- name: "id_rsa"
259
- known_hosts: ${{ vars.GERRIT_KNOWN_HOSTS }}
260
- config: |
261
- Host ${{ vars.GERRIT_SERVER }}
262
- User ${{ vars.GERRIT_SSH_USER_G2G }}
263
- Port ${{ vars.GERRIT_SERVER_PORT }}
264
- PubkeyAcceptedKeyTypes +ssh-rsa
265
- IdentityFile ~/.ssh/id_rsa
262
+
266
263
 
267
264
  - name: Submit PR to Gerrit (with explicit overrides)
268
265
  id: g2g
@@ -296,10 +293,10 @@ jobs:
296
293
 
297
294
  Notes:
298
295
 
299
- - If both this step and the action define SSH configuration, the last
300
- configuration applied in the runner wins.
301
- - For most users, you can rely on the action’s built-in SSH setup. Use this
302
- advanced configuration when you need custom SSH behavior or hosts.
296
+ - The action configures SSH internally using the provided inputs (key,
297
+ known_hosts) and does not use the runner’s SSH agent or ~/.ssh/config.
298
+ - Do not add external steps to install SSH keys or edit SSH config; they’re
299
+ unnecessary and may conflict with the action.
303
300
 
304
301
  ## GitHub Enterprise support
305
302
 
@@ -31,11 +31,24 @@ inputs:
31
31
  description: "SSH private key content used to authenticate to Gerrit"
32
32
  required: true
33
33
  GERRIT_SSH_USER_G2G:
34
- description: "Gerrit SSH username (e.g. automation bot account)"
35
- required: true
34
+ description: >
35
+ Gerrit SSH username (e.g. automation bot account). In GitHub Actions,
36
+ automatically derived as [ORGANIZATION].gh2gerrit when not provided if
37
+ G2G_ENABLE_DERIVATION=true (default: false). For local CLI usage,
38
+ derivation is enabled by default; set
39
+ G2G_ENABLE_DERIVATION=false to disable.
40
+ required: false
41
+ default: ""
36
42
  GERRIT_SSH_USER_G2G_EMAIL:
37
- description: "Email address associated to the Gerrit SSH user"
38
- required: true
43
+ description: >
44
+ Email address associated to the Gerrit SSH user. In GitHub Actions,
45
+ automatically derived as
46
+ releng+[ORGANIZATION]-gh2gerrit@linuxfoundation.org when not provided if
47
+ G2G_ENABLE_DERIVATION=true (default: false). For local CLI usage,
48
+ derivation is enabled by default; set
49
+ G2G_ENABLE_DERIVATION=false to disable.
50
+ required: false
51
+ default: ""
39
52
 
40
53
  # Behavior and metadata
41
54
  ORGANIZATION:
@@ -67,9 +80,21 @@ inputs:
67
80
  required: false
68
81
  default: ""
69
82
 
83
+ DUPLICATES:
84
+ description: >
85
+ Comma-separated Gerrit statuses to consider for duplicate
86
+ detection (e.g., open,merged,abandoned)
87
+ required: false
88
+ default: "open"
89
+
70
90
  # Optional Gerrit overrides (used when .gitreview is missing)
71
91
  GERRIT_SERVER:
72
- description: "Gerrit server hostname (optional; use .gitreview if present)"
92
+ description: >
93
+ Gerrit server hostname (optional; use .gitreview if present). In GitHub
94
+ Actions, automatically derived as gerrit.[ORGANIZATION].org when not
95
+ provided if G2G_ENABLE_DERIVATION=true (default: false). For local CLI
96
+ usage, derivation is enabled by default; set G2G_ENABLE_DERIVATION=false
97
+ to disable.
73
98
  required: false
74
99
  default: ""
75
100
  GERRIT_SERVER_PORT:
@@ -191,19 +216,6 @@ runs:
191
216
  fi
192
217
  fi
193
218
 
194
- - name: Install SSH key for Gerrit
195
- # yamllint disable-line rule:line-length
196
- uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2.7.0
197
- with:
198
- key: ${{ inputs.GERRIT_SSH_PRIVKEY_G2G }}
199
- name: "id_rsa"
200
- known_hosts: ${{ inputs.GERRIT_KNOWN_HOSTS }}
201
- config: |
202
- Host ${{ inputs.GERRIT_SERVER || env.GERRIT_SERVER }}
203
- User ${{ inputs.GERRIT_SSH_USER_G2G }}
204
- Port ${{ inputs.GERRIT_SERVER_PORT }}
205
- PubkeyAcceptedKeyTypes +ssh-rsa
206
- IdentityFile ~/.ssh/id_rsa
207
219
 
208
220
  - name: Run github2gerrit Python CLI
209
221
  id: run-cli
@@ -227,6 +239,7 @@ runs:
227
239
  DRY_RUN: ${{ inputs.DRY_RUN }}
228
240
  ALLOW_DUPLICATES: ${{ inputs.ALLOW_DUPLICATES }}
229
241
  ISSUE_ID: ${{ inputs.ISSUE_ID }}
242
+ DUPLICATES: ${{ inputs.DUPLICATES }}
230
243
 
231
244
  # Optional Gerrit overrides (when .gitreview is missing)
232
245
  GERRIT_SERVER: ${{ inputs.GERRIT_SERVER }}
@@ -71,10 +71,12 @@ dev = [
71
71
 
72
72
  # Type checking helpers
73
73
  "pytest-mock>=3.14.0",
74
+ "types-requests>=2.31.0",
75
+ "types-click>=7.1.8",
74
76
  ]
75
77
 
76
78
  [tool.ruff]
77
- line-length = 80
79
+ line-length = 120
78
80
  target-version = "py311"
79
81
 
80
82
  [tool.ruff.lint]
@@ -90,7 +92,9 @@ ignore = [
90
92
  ]
91
93
 
92
94
  [tool.ruff.lint.per-file-ignores]
93
- "tests/*.py" = ["S101", "S105", "PLW0603", "E501", "TRY003"]
95
+ "tests/*.py" = ["S101", "S105", "PLW0603", "TRY003"]
96
+ "sitecustomize.py" = ["S110", "SIM103", "SIM105", "PLW2901"]
97
+ "src/github2gerrit/duplicate_detection.py" = ["S310"]
94
98
 
95
99
  [tool.ruff.lint.isort]
96
100
  known-first-party = ["github2gerrit"]
@@ -121,12 +125,27 @@ exclude = [
121
125
  "tests/fixtures/",
122
126
  ]
123
127
 
128
+ [[tool.mypy.overrides]]
129
+ module = ["pygerrit2", "pygerrit2.*"]
130
+ ignore_missing_imports = true
124
131
 
132
+ [[tool.mypy.overrides]]
133
+ module = ["click", "click.*"]
134
+ ignore_missing_imports = true
125
135
 
126
136
  [[tool.mypy.overrides]]
127
- module = ["pygerrit2", "pygerrit2.*"]
137
+ module = ["typer", "typer.*"]
128
138
  ignore_missing_imports = true
129
139
 
140
+ [[tool.mypy.overrides]]
141
+ module = ["pytest", "pytest.*"]
142
+ ignore_missing_imports = true
143
+
144
+ [[tool.mypy.overrides]]
145
+ module = ["tests.*"]
146
+ disallow_untyped_defs = false
147
+ disallow_untyped_calls = false
148
+
130
149
  [tool.coverage.run]
131
150
  branch = true
132
151
  source = ["src/github2gerrit"]
@@ -153,5 +172,3 @@ testpaths = ["tests"]
153
172
  # No extra settings are required here; this stanza reserves the
154
173
  # namespace for future use if needed.
155
174
  managed = true
156
-
157
-
@@ -81,7 +81,9 @@ def _iter_cov_candidates(base: Path) -> Iterable[Path]:
81
81
  _dbg(f"Failed to iterate {base}: {exc}")
82
82
 
83
83
 
84
- def _clean_stale_coverage_files(bases: Iterable[Path], protect: Path | None) -> None:
84
+ def _clean_stale_coverage_files(
85
+ bases: Iterable[Path], protect: Path | None
86
+ ) -> None:
85
87
  protected = str(protect.resolve()) if protect else None
86
88
  for base in bases:
87
89
  try:
@@ -109,7 +111,10 @@ def _ensure_unique_coverage_file() -> Path:
109
111
  except Exception:
110
112
  # Fall through to create a sane default
111
113
  pass
112
- unique = Path(tempfile.gettempdir()) / f".coverage.pytest.{os.getpid()}.{uuid.uuid4().hex}"
114
+ unique = (
115
+ Path(tempfile.gettempdir())
116
+ / f".coverage.pytest.{os.getpid()}.{uuid.uuid4().hex}"
117
+ )
113
118
  os.environ["COVERAGE_FILE"] = str(unique)
114
119
  return unique
115
120