ollama / ollama/ollama-python

Tests fail on Windows due to NamedTemporaryFile locking behavior

Open Beginner friendly
#676 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.5k
Forks
1.2k
Avg merge
4m
Merged PRs (30d)
1

Description

Description

Several tests fail on Windows because tempfile.NamedTemporaryFile()
locks the file while open, preventing other processes from reading it.
This works fine on Mac/Linux but not Windows.

Failing Tests

  • test_client_generate_images
  • test_client_create_blob
  • test_client_create_blob_exists
  • test_async_client_generate_images
  • test_async_client_create_blob
  • test_async_client_create_blob_exists
  • test_image_serialization_path
  • test_image_serialization_string_path

Environment

  • OS: Windows
  • Python: 3.14.3

Error

PermissionError: [Errno 13] Permission denied: 'C:\Users...\Temp\tmp...'

Proposed Fix

Add delete=False to NamedTemporaryFile() calls in the affected tests.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the tempfile.NamedTemporaryFile() calls used by test_client_generate_images, test_client_create_blob, test_client_create_blob_exists, their async counterparts, and the image serialization path tests. Run the listed tests on Windows to reproduce the PermissionError, then verify they complete without the temporary-file locking failure after the proposed change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.