File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Tests for the deeprank scoring module wrapper."""
22
3- import tempfile
3+ import builtins
44import shutil
5+ import tempfile
56from pathlib import Path
67
78import pytest
89
9- from haddock .modules .scoring .deeprank .deeprank import DeeprankWrapper
10+ from haddock .modules .scoring .deeprank .deeprank import (
11+ DeeprankWrapper ,
12+ deeprank_is_available ,
13+ )
1014
1115from . import golden_data as GOLDEN_DATA
1216from .conftest import has_deeprank
@@ -43,6 +47,22 @@ def deeprank_wrapper_ensemble():
4347 )
4448
4549
50+ def test_deeprank_is_available_requires_sqlite3 (monkeypatch ):
51+ """Must raise a clear error when the interpreter lacks sqlite3 support."""
52+ real_import = builtins .__import__
53+
54+ # mock not being able to find `sqlite3`
55+ def fake_import (name , * args , ** kwargs ):
56+ if name == "sqlite3" :
57+ raise ImportError ("No module named '_sqlite3'" )
58+ return real_import (name , * args , ** kwargs )
59+
60+ monkeypatch .setattr (builtins , "__import__" , fake_import )
61+
62+ with pytest .raises (ImportError , match = "sqlite3" ):
63+ deeprank_is_available ()
64+
65+
4666@has_deeprank
4767def test_run (deeprank_wrapper ):
4868 """`run()` must return the score for the single input model."""
You can’t perform that action at this time.
0 commit comments