Skip to content

Commit 340e73e

Browse files
committed
Fix macOS and Windows CI test failures
macOS fixes: - Replace mapfile with while loop (mapfile is bash 4+ only, macOS has bash 3.x/zsh) - Fixes 'mapfile: command not found' error Windows fixes: - Add nobackup and nowritebackup to vimrc to prevent backup file errors - Fix Windows path resolution issue with os.path.relpath (handles different drive letters) - Create C:\tmp directory for test compatibility (/tmp/ paths in tests) - Fixes E510 backup file errors and ValueError path resolution errors These changes address the specific CI failures: - macOS: exit code 127 (command not found) - Windows: E510 backup errors, E212 /tmp/ path errors, ValueError drive letter errors
1 parent 872944f commit 340e73e

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

pymode/ruff_integration.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,14 @@ def code_check():
390390
content = '\n'.join(env.curbuf) + '\n'
391391
file_path = env.curbuf.name
392392

393-
env.debug("Start ruff code check: ", os.path.relpath(file_path, env.curdir))
393+
# Use relpath if possible, but handle Windows drive letter differences
394+
try:
395+
rel_path = os.path.relpath(file_path, env.curdir)
396+
env.debug("Start ruff code check: ", rel_path)
397+
except ValueError:
398+
# On Windows, relpath fails if paths are on different drives
399+
# Fall back to absolute path in this case
400+
env.debug("Start ruff code check (abs path): ", file_path)
394401

395402
# Run ruff check
396403
errors = run_ruff_check(file_path, content)

scripts/cicd/run_vader_tests_direct.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,11 @@ log_info "Created CI vimrc at ${CI_VIMRC}"
149149
# Find test files
150150
TEST_FILES=()
151151
if [[ -d "tests/vader" ]]; then
152-
mapfile -t TEST_FILES < <(find tests/vader -name "*.vader" -type f | sort)
152+
# Use while read loop instead of mapfile for better compatibility (macOS bash/zsh)
153+
# mapfile is bash 4+ only, macOS has bash 3.x or uses zsh
154+
while IFS= read -r file; do
155+
TEST_FILES+=("$file")
156+
done < <(find tests/vader -name "*.vader" -type f | sort)
153157
fi
154158

155159
if [[ ${#TEST_FILES[@]} -eq 0 ]]; then

scripts/cicd/run_vader_tests_windows.ps1

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,19 @@ Write-Info "Project root: $ProjectRoot"
3535
Write-Info "PowerShell version: $($PSVersionTable.PSVersion)"
3636
Write-Info "OS: $([System.Environment]::OSVersion.VersionString)"
3737

38+
# Create /tmp symlink or directory for Windows compatibility
39+
# Some tests use /tmp/ paths which don't exist on Windows
40+
$TmpDir = $env:TEMP
41+
if (-not (Test-Path "C:\tmp")) {
42+
# Try to create C:\tmp directory
43+
try {
44+
New-Item -ItemType Directory -Path "C:\tmp" -Force | Out-Null
45+
Write-Info "Created C:\tmp directory for test compatibility"
46+
} catch {
47+
Write-Warn "Could not create C:\tmp, tests using /tmp/ may fail"
48+
}
49+
}
50+
3851
# Try python3 first, then python, then py
3952
$PythonCmd = $null
4053
if (Get-Command python3 -ErrorAction SilentlyContinue) {
@@ -120,6 +133,8 @@ set directory=
120133
set undodir=
121134
set viewdir=
122135
set noswapfile
136+
set nobackup
137+
set nowritebackup
123138
set paste
124139
set shell=cmd.exe
125140

0 commit comments

Comments
 (0)