Skip to content

Commit f4e2bd2

Browse files
committed
fix tests
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
1 parent 57123f4 commit f4e2bd2

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

tests/test_api/test_flow.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ def flow_v1(http_client_v1, minio_client) -> FlowV1API:
2020

2121

2222
@pytest.fixture
23-
def flow_v2(http_client_v2, minio_client) -> FlowV2API:
23+
def flow_v2(minio_client) -> FlowV2API:
24+
from openml.enums import APIVersion
25+
if openml.config.servers[APIVersion.V2]["server"] is None:
26+
pytest.skip("V2 server is not configured")
27+
from openml._api import HTTPClient
28+
http_client_v2 = HTTPClient(api_version=APIVersion.V2)
2429
return FlowV2API(http=http_client_v2, minio=minio_client)
2530

2631

tests/test_flows/test_flow.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import re
88
import os
99
import time
10-
import uuid
1110
from packaging.version import Version
1211
from unittest import mock
1312

1413
import pytest
14+
import requests
1515
import scipy.stats
1616
import sklearn
1717
import sklearn.datasets
@@ -31,8 +31,8 @@
3131
import openml
3232
import openml.exceptions
3333
import openml.utils
34-
import requests
35-
from openml.testing import SimpleImputer, TestBase, create_request_response
34+
35+
from openml.testing import SimpleImputer, TestBase
3636

3737

3838
class TestFlow(TestBase):
@@ -117,7 +117,7 @@ def test_tagging(self):
117117
flow.push_tag(tag)
118118
flows = openml.flows.list_flows(tag=tag)
119119
assert len(flows) == 1
120-
assert flow_id in flows["id"].values
120+
assert flow_id in flows["id"]
121121
flow.remove_tag(tag)
122122
flows = openml.flows.list_flows(tag=tag)
123123
assert len(flows) == 0
@@ -299,15 +299,14 @@ def test_semi_legal_flow(self):
299299
TestBase._mark_entity_for_removal("flow", flow.flow_id, flow.name)
300300
TestBase.logger.info(f"collected from {__file__.split('/')[-1]}: {flow.flow_id}")
301301

302-
303302
@pytest.mark.sklearn()
304303
@mock.patch("openml.flows.functions.get_flow")
305304
@mock.patch("openml.flows.functions.flow_exists")
306305
@mock.patch("requests.Session.request")
307306
def test_publish_error(self, mock_request, flow_exists_mock, get_flow_mock):
308307
model = sklearn.ensemble.RandomForestClassifier()
309308
flow = self.extension.model_to_flow(model)
310-
309+
311310
# Create mock response directly
312311
response = requests.Response()
313312
response.status_code = 200

0 commit comments

Comments
 (0)