pytest-dev / pytest-dev/pytest-qt

High memory usage - Suspected cleanup not done per testcase

Open
#569 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question :question:
Dominant language
Python
Stars
455
Forks
72
Avg merge
12h 26m
Merged PRs (30d)
1

Description

For testing our application, Loadouts for Genshin Impact, we see a very high memory usage of up to 4.0 GiB even when the actual run of the application takes somewhere in the neighbourhood of 200 MiB of memory. This starts from a meagre 100 MiB and with the run of each testcase associated with pytest-qt, it adds around 100 MiB of memory which doesn't get offloaded until the end of the entire test run. We currently have around 842 tests out of which around half are associated with pytest-qt. Ideally, if the cleanups were done per testcase, we expect the run to stay well under 500 MiB of memory usage.

Here's what the conftest module looks like where our fixture is located.

import pytest

from gi_loadouts.face.wind.main import MainWindow


@pytest.fixture
def runner(qtbot):
    testwind = MainWindow()
    qtbot.addWidget(testwind)
    return testwind

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 with the linked test/conftest.py fixture and reproduce the memory growth using the pytest-qt tests in the linked Loadouts for Genshin Impact project. Trace how qtbot.addWidget(testwind) handles cleanup between testcases and compare memory usage across the run. Done means the reported per-testcase growth is resolved or its cause is identified with a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.