Skip to content

Commit 38443f9

Browse files
wmaynerclaude
andcommitted
Fix Windows CI test failure for test_network_from_json
Use delete_on_close=False for NamedTemporaryFile to allow reopening the file by name on Windows, which has exclusive file locking. Also remove continue-on-error for Windows now that the issue is fixed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 46ca112 commit 38443f9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ jobs:
3434
- name: Run tests
3535
if: ${{ !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12') }}
3636
run: uv run pytest test/ --tb=short -v --ignore=test/test_parallel.py --ignore=test/test_parallel2.py
37-
continue-on-error: ${{ matrix.os == 'windows-latest' }}
3837

3938
- name: Run tests with coverage
4039
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'

test/test_json.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def test_deserialization_memoizes_duplicate_objects(s):
9999

100100
@pytest.fixture
101101
def network_file(standard):
102-
with tempfile.NamedTemporaryFile(mode="w+") as f:
102+
# delete_on_close=False allows reopening the file by name on Windows
103+
# (Windows doesn't allow opening a file that's already open)
104+
with tempfile.NamedTemporaryFile(mode="w+", delete_on_close=False) as f:
103105
jsonify.dump(standard, f)
104106
f.seek(0)
105107
yield f

0 commit comments

Comments
 (0)