Skip to content

Commit aa9d486

Browse files
committed
correct the tests
1 parent 63fa0a0 commit aa9d486

2 files changed

Lines changed: 5 additions & 16 deletions

File tree

tests/test_api/test_flow.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from openml.flows.flow import OpenMLFlow
1313
from openml.testing import TestAPIBase
1414

15-
15+
@pytest.mark.uses_test_server()
1616
class TestFlowsV1(TestAPIBase):
1717
"""Test FlowsV1 resource implementation."""
1818

@@ -21,7 +21,6 @@ def setUp(self):
2121
http_client = self.http_clients[APIVersion.V1]
2222
self.resource = FlowV1API(http_client)
2323

24-
@pytest.mark.uses_test_server()
2524
def test_get(self):
2625
"""Test getting a flow from the V1 API."""
2726
flow = self.resource.get(flow_id=1)
@@ -31,7 +30,6 @@ def test_get(self):
3130
self.assertIsInstance(flow.name, str)
3231
self.assertGreater(len(flow.name), 0)
3332

34-
@pytest.mark.uses_test_server()
3533
def test_exists(self):
3634
"""Test checking if a flow exists using V1 API."""
3735
flow = self.resource.get(flow_id=1)
@@ -45,7 +43,6 @@ def test_exists(self):
4543
self.assertGreater(result, 0)
4644
self.assertEqual(result, flow.flow_id)
4745

48-
@pytest.mark.uses_test_server()
4946
def test_exists_nonexistent(self):
5047
"""Test checking if a non-existent flow exists using V1 API."""
5148
result = self.resource.exists(
@@ -55,7 +52,6 @@ def test_exists_nonexistent(self):
5552

5653
self.assertFalse(result)
5754

58-
@pytest.mark.uses_test_server()
5955
def test_list(self):
6056
"""Test listing flows from the V1 API."""
6157
flows_df = self.resource.list(limit=10)
@@ -69,24 +65,21 @@ def test_list(self):
6965
self.assertIn("full_name", flows_df.columns)
7066
self.assertIn("uploader", flows_df.columns)
7167

72-
@pytest.mark.uses_test_server()
7368
def test_list_with_offset(self):
7469
"""Test listing flows with offset from the V1 API."""
7570
flows_df = self.resource.list(limit=5, offset=10)
7671

7772
self.assertGreater(len(flows_df), 0)
7873
self.assertLessEqual(len(flows_df), 5)
7974

80-
@pytest.mark.uses_test_server()
8175
def test_list_with_tag_limit_offset(self):
8276
"""Test listing flows with filters from the V1 API."""
8377
flows_df = self.resource.list(tag="weka", limit=5, offset=0, uploader=16)
8478

8579
self.assertTrue(hasattr(flows_df, "columns"))
8680
if len(flows_df) > 0:
8781
self.assertIn("id", flows_df.columns)
88-
89-
@pytest.mark.uses_test_server()
82+
9083
def test_delete_and_publish(self):
9184
"""Test deleting a flow using V1 API."""
9285
from openml_sklearn.extension import SklearnExtension
@@ -121,7 +114,7 @@ def test_delete_and_publish(self):
121114
)
122115
self.assertFalse(exists)
123116

124-
117+
@pytest.mark.uses_test_server()
125118
class TestFlowsV2(TestFlowsV1):
126119
"""Test FlowsV2 resource implementation."""
127120

@@ -130,27 +123,23 @@ def setUp(self):
130123
http_client = self.http_clients[APIVersion.V2]
131124
self.resource = FlowV2API(http_client)
132125

133-
@pytest.mark.uses_test_server()
134126
def test_list(self):
135127
with pytest.raises(OpenMLNotSupportedError):
136128
super().test_list()
137129

138-
@pytest.mark.uses_test_server()
139130
def test_list_with_offset(self):
140131
with pytest.raises(OpenMLNotSupportedError):
141132
super().test_list_with_offset()
142133

143-
@pytest.mark.uses_test_server()
144134
def test_list_with_tag_limit_offset(self):
145135
with pytest.raises(OpenMLNotSupportedError):
146136
super().test_list_with_tag_limit_offset()
147137

148-
@pytest.mark.uses_test_server()
149138
def test_delete_and_publish(self):
150139
with pytest.raises(OpenMLNotSupportedError):
151140
super().test_delete_and_publish()
152141

153-
142+
@pytest.mark.uses_test_server()
154143
class TestFlowsFallback(TestFlowsV1):
155144
"""Test combined functionality and fallback between V1 and V2."""
156145

tests/test_flows/test_flow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def test_semi_legal_flow(self):
301301

302302
@pytest.mark.sklearn()
303303
@mock.patch("openml.flows.functions.get_flow")
304-
@mock.patch("openml._api_calls._perform_api_call")
304+
@mock.patch("openml._api.clients.http.HTTPClient.post")
305305
@mock.patch("openml.flows.functions.flow_exists")
306306
def test_publish_error(self, api_call_mock, flow_exists_mock, get_flow_mock):
307307
model = sklearn.ensemble.RandomForestClassifier()

0 commit comments

Comments
 (0)