-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #156 from oesteban/fix/auto-lowmem-mode
ENH: Add a memory check to dynamically limit interpolation blocksize
- Loading branch information
Showing
5 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"""Test miscellaneous utilities.""" | ||
import sys | ||
from collections import namedtuple | ||
import types | ||
import pytest | ||
from ..misc import get_free_mem | ||
|
||
|
||
@pytest.mark.parametrize("retval", [None, 10]) | ||
def test_get_free_mem(monkeypatch, retval): | ||
"""Test the get_free_mem utility.""" | ||
|
||
def mock_func(): | ||
if retval is None: | ||
raise ImportError | ||
return namedtuple("Mem", ("free",))(free=retval) | ||
|
||
psutil = types.ModuleType("psutil") | ||
psutil.virtual_memory = mock_func | ||
monkeypatch.setitem(sys.modules, "psutil", psutil) | ||
assert get_free_mem() == retval |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters