Repository navigation
Closed
Description
#416 made some changes to how tests are run. Specifically, this change set added a post-collection hook to the pytest configuration for Mellea. This hook looks for selected tests that are marked with the "requires_heavy_ram" tag. If it finds such tests, it runs these tests in separate processes, one process per Python source file. This change appears to be intended to prevent tests from running out of GPU memory.
This new way of doing testing created problems:
- If any selected tests for the current session have the "requires_heavy_ram" marker, then tests that do not have this marker will not run. For example, the command
uv run pytest testwill only run 51 of the 451 tests in the project. - The collection hook breaks pytest's
--discoveroption, which in turn breaks Visual Studio Code's pytest support. Because Visual Studio Code cannot enumerate tests in the project, the Visual Studio Code UI cannot run or debug individual tests. - The process isolation mechanism hides memory leaks. Mellea applications are supposed to be able to start and stop backends without leaking memory.
- Ollama-based tests still leak GPU memory, even when run under the new process isolation. These tests do not tell Ollama to stop serving their target models.
- Ollama eventually shuts down models several minutes after Ollama-based tests have completed. If a vLLM test is running while one of these Ollama shutdown events occurs, the vLLM server will detect that available GPU memory has changed and will fail the entire test suite with several pages of stack trace.
- If a test in a subprocess fails, the main process will not tell you that it failed but will instead report, "Heavy GPU tests completed in isolated processes". To determine whether the tests in a given run succeeded, one needs to scroll through several screens of output, carefully checking for failed tests in each separate process's output.
- The "requires_heavy_ram" marker does not appear to be intended to flag heavy GPU RAM usage, but instead is intended to flag CPU RAM requirements in excess of 48GB. Some tests that are not marked with "requires_heavy_ram" use just as much GPU memory as the tests that have the marker.
- Occasionally one of the background processes will hang indefinitely for no apparent reason.
Metadata
Metadata
Assignees
Labels
No labels
Activity
planetf1 commentedon Mar 7, 2026
Thanks @frreiss for spotting these issues.
#446 was intended to address probems with the way the nvidia driver locks gpu memory at the os process level - so regular python/pytorch cleanup wasn't effective in achieving cleanup - so we had oom crashes when running multiple tests. - but of course these had these undesirable effects that we hadn't noticed :-
I think the tests could be fixed with:
--collect-onlybypasses the isolation code - which should ensure vscode collection works (I'd not tried the vscode plugin, cli seemed fine)pytest.exit()and instead properly filter the test list (we lost tests here - not good)I'll give a go and create a PR - it would be great if you could give it a go. If you have other ideas too let's discuss!
(I did consider some of the plugins, but I don't think they're flexible enough given the hardware limitations) (aside: what environment were you running it - I can test in bluevela or on a 32GB mac m1 easily. other configs harder)
The objective is to reliably run as many tests as possible, with clear results, in many different configurations, with minimal developer workload....
fix: restore VSCode test discovery and make GPU isolation opt-in
fix: address review feedback for issue generative-computing#604
fix: restore VSCode test discovery and make GPU isolation opt-in
fix: restore VSCode test discovery and make GPU isolation opt-in
fix: restore VSCode test discovery and make GPU isolation opt-in
planetf1 commentedon Mar 7, 2026
Added #605 - have done local tests. Would be great @frreiss if you could check/rerun. I'll do some more testing Mon.
planetf1 commentedon Mar 9, 2026
PR now ready for review/merge
fix: restore VSCode test discovery and make GPU isolation opt-in
fix: restore VSCode test discovery and make GPU isolation opt-in
fix: restore VSCode test discovery and make GPU isolation opt-in (#605)
fix: restore VSCode test discovery and make GPU isolation opt-in (gen…