Skip to content

r.kappa: Avoid reopening NamedTemporaryFile on Windows in testsuite - #7907

Merged
echoix merged 2 commits into
OSGeo:mainfrom
echoix:claude/r-kappa-fix-separation-fjn5nx
Sep 6, 2026
Merged

echoix merged 2 commits into
OSGeo:mainfrom
echoix:claude/r-kappa-fix-separation-fjn5nx

Conversation

@echoix

@echoix echoix commented Sep 6, 2026

Copy link
Copy Markdown
Member

Description

test_file in raster/r.kappa/testsuite/test_r_kappa.py kept a
NamedTemporaryFile handle open while passing its path to r.kappa as the
output file. Windows rejects a second process opening a file while the
creating process still holds the handle open; POSIX allows it. Use
grass.script.core.tempfile() to get an unopened path instead, the same fix
already applied to r.mfilter's testsuite in #7878, and drop the
now-unneeded @xfail_windows marker.

Motivation and context

Split out of a PR, which bundled this fix together with unrelated Windows CI
changes (randomized test order infrastructure) (which is now filed as #7906).
This is a standalone, independently mergeable fix.

How has this been tested?

Mirrors the already-merged, already-verified fix for the identical
anti-pattern in r.mfilter (#7878).

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • PR title provides summary of the changes and starts with one of the
    pre-defined prefixes
  • My code follows the code style
    of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

Generated with Claude Code, from my instructions. (I still reworded the PR body)

echoix and others added 2 commits September 6, 2026 08:40
test_file kept a NamedTemporaryFile handle open while passing its path
to r.kappa as the output file. Windows rejects a second process
opening a file while the creating process still holds the handle;
POSIX allows it. Use grass.script.core.tempfile() to get an unopened
path instead, the same fix already applied to r.mfilter's testsuite in
OSGeo#7878, and drop the now-unneeded @xfail_windows marker.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@echoix
echoix enabled auto-merge (squash) September 6, 2026 15:59
@echoix
echoix merged commit b43c9b8 into OSGeo:main Sep 6, 2026
25 checks passed
@github-actions github-actions Bot added raster Related to raster data processing Python Related code is in Python module tests Related to Test Suite labels Sep 6, 2026
@github-actions github-actions Bot added this to the 8.6.0 milestone Sep 6, 2026
@echoix
echoix deleted the claude/r-kappa-fix-separation-fjn5nx branch September 12, 2026 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module Python Related code is in Python raster Related to raster data processing tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants