Skip to content

Commit 475706b

Browse files
committed
update cache tests
1 parent 9d7618c commit 475706b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

tests/test_runs/test_run_functions.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,14 +1660,19 @@ def test_run_on_dataset_with_missing_labels_array(self):
16601660
assert len(row) == 12
16611661

16621662
@pytest.mark.test_server()
1663-
def test_get_cached_run(self):
1663+
@mock.patch.object(requests.Session, "request")
1664+
def test_get_cached_run(self, mock_request):
16641665
openml.config.set_root_cache_directory(self.static_cache_dir)
1665-
openml.runs.functions._get_cached_run(1)
1666+
mock_request.side_effect = Exception("Mocked Exception")
1667+
openml.runs.get_run(1)
16661668

1667-
def test_get_uncached_run(self):
1669+
@pytest.mark.test_server()
1670+
@mock.patch.object(requests.Session, "request")
1671+
def test_get_uncached_run(self, mock_request):
16681672
openml.config.set_root_cache_directory(self.static_cache_dir)
1669-
with pytest.raises(openml.exceptions.OpenMLCacheException):
1670-
openml.runs.functions._get_cached_run(10)
1673+
mock_request.side_effect = Exception("Mocked Exception")
1674+
with pytest.raises(Exception, match="Mocked Exception"):
1675+
openml.runs.get_run(10)
16711676

16721677
@pytest.mark.sklearn()
16731678
@pytest.mark.test_server()

0 commit comments

Comments
 (0)