From f6c30f2fe8e28889e9e3fe77a1099d6d8ca20fdc Mon Sep 17 00:00:00 2001 From: Seth Freiberg Date: Wed, 29 Apr 2026 12:03:57 -0400 Subject: [PATCH] test: move bats scratch dirs to repo-local .test-scratch/ (per global no-/tmp/ rule) Co-Authored-By: Claude Sonnet 4.6 --- .gitignore | 3 +++ tests-impl/test-check-no-upstream-edits.bats | 3 ++- tests-impl/test-compute-version.bats | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 453d25c..2e23343 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,6 @@ scripts/.cache/ # Locally-produced AppImage artifacts *.AppImage + +# Bats test scratch directories (created/cleaned per test) +.test-scratch/ diff --git a/tests-impl/test-check-no-upstream-edits.bats b/tests-impl/test-check-no-upstream-edits.bats index 952f661..fbd0d0a 100644 --- a/tests-impl/test-check-no-upstream-edits.bats +++ b/tests-impl/test-check-no-upstream-edits.bats @@ -19,7 +19,8 @@ teardown() { # Build a minimal disposable repo that mimics the sethLabels structure with a # local "upstream/master" ref. Returns its path via stdout. make_test_repo() { - local tmp=$(mktemp -d) + mkdir -p "$REPO_ROOT/.test-scratch" + local tmp=$(mktemp -d -p "$REPO_ROOT/.test-scratch") cd "$tmp" git init -q -b master git config user.email "test@test" diff --git a/tests-impl/test-compute-version.bats b/tests-impl/test-compute-version.bats index 7a84026..66ee346 100644 --- a/tests-impl/test-compute-version.bats +++ b/tests-impl/test-compute-version.bats @@ -47,7 +47,8 @@ setup() { @test "fails cleanly when upstream/master ref is missing" { # Run in a temp git repo with no upstream remote. - tmp=$(mktemp -d) + mkdir -p "$REPO_ROOT/.test-scratch" + tmp=$(mktemp -d -p "$REPO_ROOT/.test-scratch") cd "$tmp" git init -q git commit --allow-empty -m "init" -q