Skip to content

Commit

Permalink
patch psutil virtual memory for test suite in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Sep 11, 2024
1 parent aab3885 commit 29c28a7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import uuid
from collections.abc import Generator
from pathlib import PosixPath
from typing import NamedTuple

import attrs
import pytest
Expand Down Expand Up @@ -32,6 +33,29 @@
collect_ignore = ["setup.py"]


@pytest.fixture(autouse=True)
def virtual_memory(mocker):
class VirtualMemory(NamedTuple):
total: int
available: int
percent: int
used: int
free: int

return mocker.patch(
"psutil.virtual_memory",
return_value=VirtualMemory(
total=1073741824,
available=5368709120,
# prevent dumping of smaller batches to db in process_udf_outputs
# we want to avoid this due to tests running concurrently (xdist)
percent=50,
used=5368709120,
free=5368709120,
),
)


@pytest.fixture(scope="session")
def monkeypatch_session() -> Generator[MonkeyPatch, None, None]:
"""
Expand Down

0 comments on commit 29c28a7

Please sign in to comment.