Skip to content

Commit

Permalink
[python] Skip tests that use to much memory for GitHub runners
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiashienzsch committed Aug 31, 2024
1 parent 574d847 commit d623f49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dependencies = [
"psutil>=5.8.0",
"resampy>=0.2.2",
"scipy>=1.7.0",
"sympy",
"sympy>=1.13.2",
"tqdm>=4.58.0",
"vtk>=9.0.1",
]
Expand Down
14 changes: 12 additions & 2 deletions src/python/test/test_sim3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
import pathlib
import subprocess

import pytest
import numpy as np
import psutil
import pytest
import scipy.io.wavfile as wavfile

from pffdtd.analysis.room_modes import find_nearest
Expand Down Expand Up @@ -45,9 +46,16 @@ def _skip_if_native_engine_unavailable(engine):
pytest.skip("Native engine not available")


def _skip_if_not_enough_memory(engine):
if engine == "python":
if psutil.virtual_memory().available <= 6e9:
pytest.skip("Not enough memory")


@pytest.mark.parametrize("engine", ["python", "native"])
def test_sim3d_locate_sound_source(tmp_path, engine):
_skip_if_native_engine_unavailable(engine)
_skip_if_not_enough_memory(engine)

fmin = 20
fmax = 1000
Expand Down Expand Up @@ -146,6 +154,7 @@ def test_sim3d_locate_sound_source(tmp_path, engine):
@pytest.mark.parametrize("engine", ["python", "native"])
def test_sim3d_infinite_baffle(tmp_path, engine):
_skip_if_native_engine_unavailable(engine)
_skip_if_not_enough_memory(engine)

fmin = 20
fmax = 1000
Expand Down Expand Up @@ -251,11 +260,12 @@ def test_sim3d_infinite_baffle(tmp_path, engine):
"size,fmax,ppw,fcc,dx_scale,tolerance",
[
((2.8, 2.076, 1.48), 400, 10.5, False, 2, 3.0),
((3.0, 1.0, 2.0), 800, 7.7, True, 3, 6),
((3.0, 1.0, 2.0), 600, 7.7, True, 3, 6),
]
)
def test_sim3d_detect_room_modes(tmp_path, engine, size, fmax, ppw, fcc, dx_scale, tolerance):
_skip_if_native_engine_unavailable(engine)
_skip_if_not_enough_memory(engine)

L = size[0]
W = size[1]
Expand Down

0 comments on commit d623f49

Please sign in to comment.