Skip to content

[bug]: Some pytests are failing randomly #97

Description

@lstein

Is there an existing issue for this problem?

  • I have searched the existing issues

Install method

Invoke's Launcher

Operating system

Linux

GPU vendor

Nvidia (CUDA)

GPU model

No response

GPU VRAM

No response

Version number

branch feature/multiuser

Browser

No response

System Information

No response

What happened

Two of the tests in the pytest action are randomly failing. They both seem to involve the download queue system. The failures are haphazard, and may be race conditions. They only started to appear in the feature/multiuser branch pull request on upstream, but I don't know if it is related to the changes in that branch.

The two failing tests are tests/app/services/model_install/test_model_install.py and tests/app/services/download/test_download_queue.py.

Here is a typical stack trace:


tests/app/services/model_install/test_model_install.py ............+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Captured stderr ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[2026-02-27 01:24:04,632]::[ModelInstallService]::INFO --> Queueing model install: https://www.test.foo/download/test_embedding.safetensors (1 file)
[2026-02-27 01:24:04,633]::[DownloadQueueService]::INFO --> File download started: https://www.test.foo/download/test_embedding.safetensors
[2026-02-27 01:24:04,634]::[ModelInstallService]::INFO --> Queueing model install: https://www.test.foo/download/test_embedding.safetensors (1 file)
[2026-02-27 01:24:04,634]::[ModelInstallService]::INFO --> Finished restoring incomplete installs
[2026-02-27 01:24:04,635]::[DownloadQueueService]::INFO --> Download complete: https://www.test.foo/download/test_embedding.safetensors
[2026-02-27 01:24:04,635]::[DownloadQueueService]::INFO --> File download started: https://www.test.foo/download/test_embedding.safetensors
[2026-02-27 01:24:04,636]::[DownloadQueueService]::ERROR --> An error occurred while processing the on_start callback: ['Traceback (most recent call last):\n', '  File "/Users/runner/work/InvokeAI/InvokeAI/invokeai/app/services/download/download_default.py", line 770, in _execute_cb\n    callback(*args)\n', '  File "/Users/runner/work/InvokeAI/InvokeAI/invokeai/app/services/download/download_default.py", line 672, in _mfd_started\n    mf_job = self._download_part2parent[download_job.source]\n             ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\n', "KeyError: AnyHttpUrl('https://www.test.foo/download/test_embedding.safetensors')\n"]
[2026-02-27 01:24:04,636]::[DownloadQueueService]::INFO --> Download complete: https://www.test.foo/download/test_embedding.safetensors
[2026-02-27 01:24:04,636]::[DownloadQueueService]::ERROR --> An error occurred while processing the on_complete callback: ['Traceback (most recent call last):\n', '  File "/Users/runner/work/InvokeAI/InvokeAI/invokeai/app/services/download/download_default.py", line 770, in _execute_cb\n    callback(*args)\n', '  File "/Users/runner/work/InvokeAI/InvokeAI/invokeai/app/services/download/download_default.py", line 699, in _mfd_complete\n    mf_job = self._download_part2parent[download_job.source]\n             ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^\n', "KeyError: AnyHttpUrl('https://www.test.foo/download/test_embedding.safetensors')\n"]```

### What you expected to happen

I expect these tests to run correctly and consistently.

### How to reproduce the problem

_No response_

### Additional context

_No response_

### Discord username

_No response_

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions