Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ def mock_load_models(request):
patch("gpuma.optimizer.load_model_torchsim") as mock_load_ts, \
patch("gpuma.optimizer._get_cached_torchsim_model") as mock_get_cached_ts:

# Setup mocks
mock_calc = MagicMock()
mock_calc.results = {}

Expand Down
13 changes: 11 additions & 2 deletions tests/test_io.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sys
import pytest
from unittest.mock import patch
from unittest.mock import MagicMock, patch

from gpuma.io_handler import (
file_exists,
Expand Down Expand Up @@ -133,7 +134,15 @@ def test_smiles_to_ensemble():
assert len(structs) > 0
assert len(structs) <= 3
assert all(isinstance(s, Structure) for s in structs)
assert structs[0].n_atoms == 14 # C4H10

# Check if morfeus is mocked
is_mocked = "morfeus" in sys.modules and isinstance(sys.modules["morfeus"], MagicMock)
if not is_mocked:
assert structs[0].n_atoms == 14 # C4H10
else:
# Our mock returns 5 atoms
assert structs[0].n_atoms == 5


def test_file_exists(tmp_path):
f = tmp_path / "exists.txt"
Expand Down