Unverified Commit b28178a4 authored by Peterson, Peter's avatar Peterson, Peter Committed by GitHub
Browse files

Fail the test if there is insufficient memory (#269)

* Fail the test if there is insufficient memory
* Change from an exception to failing the test
parent cab6a467
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ import pytest
# standard imports
import os
from pathlib import Path
from psutil import virtual_memory
import re
from unittest import mock
from unittest.mock import MagicMock
@@ -65,6 +66,11 @@ def test_valid_config(
    tmpdir: Path,
    caplog,
):
    MEM_AVAILABLE = int(virtual_memory().available / 1024 / 1024 / 1024)
    MEM_REQUIRED = 23
    if MEM_AVAILABLE < MEM_REQUIRED:
        msg = f"Insufficient memory to run the test: found {MEM_AVAILABLE}GiB require {MEM_REQUIRED}GiB"
        pytest.fail(msg)
    last_tiff = IRON_MAN_DIR / "20191030_ironman_small_0070_360_760_0624.tiff"
    mock_extract_info_from_path.return_value = tweak_extract_info_from_path(last_tiff)
    mock_substitute_template.side_effect = tweak_substitute_template