Skip to content

Commit 7121e21

Browse files
Rename 'production' to 'production_server' for markers and CLI shorthands
1 parent 1ff94fe commit 7121e21

15 files changed

Lines changed: 71 additions & 69 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ jobs:
112112
fi
113113
114114
if [ "${{ matrix.sklearn-only }}" = "true" ]; then
115-
marks="sklearn and not production and not uses_test_server"
115+
marks="sklearn and not production_server and not uses_test_server"
116116
else
117-
marks="not production and not uses_test_server"
117+
marks="not production_server and not uses_test_server"
118118
fi
119119
120120
pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"
@@ -127,9 +127,9 @@ jobs:
127127
fi
128128
129129
if [ "${{ matrix.sklearn-only }}" = "true" ]; then
130-
marks="sklearn and production and not uses_test_server"
130+
marks="sklearn and production_server and not uses_test_server"
131131
else
132-
marks="production and not uses_test_server"
132+
marks="production_server and not uses_test_server"
133133
fi
134134
135135
pytest -n 4 --durations=20 --dist load -sv $codecov -o log_cli=true -m "$marks"

openml/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ def check_apikey(apikey: str) -> str:
102102

103103
def configure_server(value: str) -> None:
104104
def check_server(server: str) -> str:
105-
is_shorthand = server in ["test", "production"]
105+
is_shorthand = server in ["test", "production_server"]
106106
if is_shorthand or looks_like_url(server):
107107
return ""
108-
return "Must be 'test', 'production' or a url."
108+
return "Must be 'test', 'production_server' or a url."
109109

110110
def replace_shorthand(server: str) -> str:
111111
if server == "test":
112112
return "https://test.openml.org/api/v1/xml"
113-
if server == "production":
113+
if server == "production_server":
114114
return "https://www.openml.org/api/v1/xml"
115115
return server
116116

@@ -119,7 +119,7 @@ def replace_shorthand(server: str) -> str:
119119
value=value,
120120
check_with_message=check_server,
121121
intro_message="Specify which server you wish to connect to.",
122-
input_message="Specify a url or use 'test' or 'production' as a shorthand: ",
122+
input_message="Specify a url or use 'test' or 'production_server' as a shorthand: ",
123123
sanitize=replace_shorthand,
124124
)
125125

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ filterwarnings=[
134134
]
135135
markers = [
136136
"upload: anything that uploads to a server",
137-
"production: any interaction with the production server",
137+
"production_server: any interaction with the production server",
138+
138139
"cache: anything that interacts with the (test) cache",
139140
"test_server: tests that require the OpenML test server",
140141
]

tests/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ def pytest_sessionfinish() -> None:
189189

190190
def pytest_configure(config):
191191
config.addinivalue_line("markers", "sklearn: marks tests that use scikit-learn")
192+
config.addinivalue_line("markers", "production_server: marks tests that use the production server")
192193

193194

194195
def pytest_addoption(parser):
@@ -272,7 +273,7 @@ def as_robot() -> Iterator[None]:
272273

273274
@pytest.fixture(autouse=True)
274275
def with_server(request):
275-
if "production" in request.keywords:
276+
if "production_server" in request.keywords:
276277
openml.config.server = "https://www.openml.org/api/v1/xml"
277278
openml.config.apikey = None
278279
yield

tests/test_datasets/test_dataset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import pytest
1919

2020

21-
@pytest.mark.production()
21+
@pytest.mark.production_server()
2222
class OpenMLDatasetTest(TestBase):
2323
_multiprocess_can_split_ = True
2424

@@ -347,7 +347,7 @@ def test_add_illegal_url_ontology():
347347
assert e.code == 1106
348348

349349

350-
@pytest.mark.production()
350+
@pytest.mark.production_server()
351351
class OpenMLDatasetTestSparse(TestBase):
352352
_multiprocess_can_split_ = True
353353

tests/test_datasets/test_dataset_functions.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def test_list_datasets_empty(self):
140140
datasets = openml.datasets.list_datasets(tag="NoOneWouldUseThisTagAnyway")
141141
assert datasets.empty
142142

143-
@pytest.mark.production()
143+
@pytest.mark.production_server()
144144
def test_check_datasets_active(self):
145145
# Have to test on live because there is no deactivated dataset on the test server.
146146
self.use_production_server()
@@ -179,27 +179,27 @@ def test_illegal_length_tag(self):
179179
except openml.exceptions.OpenMLServerException as e:
180180
assert e.code == 477
181181

182-
@pytest.mark.production()
182+
@pytest.mark.production_server()
183183
def test__name_to_id_with_deactivated(self):
184184
"""Check that an activated dataset is returned if an earlier deactivated one exists."""
185185
self.use_production_server()
186186
# /d/1 was deactivated
187187
assert openml.datasets.functions._name_to_id("anneal") == 2
188188
openml.config.server = self.test_server
189189

190-
@pytest.mark.production()
190+
@pytest.mark.production_server()
191191
def test__name_to_id_with_multiple_active(self):
192192
"""With multiple active datasets, retrieve the least recent active."""
193193
self.use_production_server()
194194
assert openml.datasets.functions._name_to_id("iris") == 61
195195

196-
@pytest.mark.production()
196+
@pytest.mark.production_server()
197197
def test__name_to_id_with_version(self):
198198
"""With multiple active datasets, retrieve the least recent active."""
199199
self.use_production_server()
200200
assert openml.datasets.functions._name_to_id("iris", version=3) == 969
201201

202-
@pytest.mark.production()
202+
@pytest.mark.production_server()
203203
def test__name_to_id_with_multiple_active_error(self):
204204
"""With multiple active datasets, retrieve the least recent active."""
205205
self.use_production_server()
@@ -282,7 +282,7 @@ def test_get_dataset_uint8_dtype(self):
282282
df, _, _, _ = dataset.get_data()
283283
assert df["carbon"].dtype == "uint8"
284284

285-
@pytest.mark.production()
285+
@pytest.mark.production_server()
286286
def test_get_dataset_cannot_access_private_data(self):
287287
# Issue324 Properly handle private datasets when trying to access them
288288
self.use_production_server()
@@ -1545,7 +1545,7 @@ def test_data_fork(self):
15451545
)
15461546

15471547

1548-
@pytest.mark.production()
1548+
@pytest.mark.production_server()
15491549
def test_list_datasets_with_high_size_parameter(self):
15501550
# Testing on prod since concurrent deletion of uploded datasets make the test fail
15511551
self.use_production_server()

tests/test_evaluations/test_evaluation_functions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def _check_list_evaluation_setups(self, **kwargs):
5050
self.assertSequenceEqual(sorted(list1), sorted(list2))
5151
return evals_setups
5252

53-
@pytest.mark.production()
53+
@pytest.mark.production_server()
5454
def test_evaluation_list_filter_task(self):
5555
self.use_production_server()
5656

@@ -70,7 +70,7 @@ def test_evaluation_list_filter_task(self):
7070
assert evaluations[run_id].value is not None
7171
assert evaluations[run_id].values is None
7272

73-
@pytest.mark.production()
73+
@pytest.mark.production_server()
7474
def test_evaluation_list_filter_uploader_ID_16(self):
7575
self.use_production_server()
7676

@@ -85,7 +85,7 @@ def test_evaluation_list_filter_uploader_ID_16(self):
8585

8686
assert len(evaluations) > 50
8787

88-
@pytest.mark.production()
88+
@pytest.mark.production_server()
8989
def test_evaluation_list_filter_uploader_ID_10(self):
9090
self.use_production_server()
9191

@@ -104,7 +104,7 @@ def test_evaluation_list_filter_uploader_ID_10(self):
104104
assert evaluations[run_id].value is not None
105105
assert evaluations[run_id].values is None
106106

107-
@pytest.mark.production()
107+
@pytest.mark.production_server()
108108
def test_evaluation_list_filter_flow(self):
109109
self.use_production_server()
110110

@@ -124,7 +124,7 @@ def test_evaluation_list_filter_flow(self):
124124
assert evaluations[run_id].value is not None
125125
assert evaluations[run_id].values is None
126126

127-
@pytest.mark.production()
127+
@pytest.mark.production_server()
128128
def test_evaluation_list_filter_run(self):
129129
self.use_production_server()
130130

@@ -144,7 +144,7 @@ def test_evaluation_list_filter_run(self):
144144
assert evaluations[run_id].value is not None
145145
assert evaluations[run_id].values is None
146146

147-
@pytest.mark.production()
147+
@pytest.mark.production_server()
148148
def test_evaluation_list_limit(self):
149149
self.use_production_server()
150150

@@ -163,7 +163,7 @@ def test_list_evaluations_empty(self):
163163

164164
assert isinstance(evaluations, dict)
165165

166-
@pytest.mark.production()
166+
@pytest.mark.production_server()
167167
def test_evaluation_list_per_fold(self):
168168
self.use_production_server()
169169
size = 1000
@@ -201,7 +201,7 @@ def test_evaluation_list_per_fold(self):
201201
assert evaluations[run_id].value is not None
202202
assert evaluations[run_id].values is None
203203

204-
@pytest.mark.production()
204+
@pytest.mark.production_server()
205205
def test_evaluation_list_sort(self):
206206
self.use_production_server()
207207
size = 10
@@ -239,7 +239,7 @@ def test_list_evaluation_measures(self):
239239
assert isinstance(measures, list) is True
240240
assert all(isinstance(s, str) for s in measures) is True
241241

242-
@pytest.mark.production()
242+
@pytest.mark.production_server()
243243
def test_list_evaluations_setups_filter_flow(self):
244244
self.use_production_server()
245245
flow_id = [405]
@@ -257,7 +257,7 @@ def test_list_evaluations_setups_filter_flow(self):
257257
keys = list(evals["parameters"].values[0].keys())
258258
assert all(elem in columns for elem in keys)
259259

260-
@pytest.mark.production()
260+
@pytest.mark.production_server()
261261
@pytest.mark.xfail(reason="failures_issue_1544", strict=False)
262262
def test_list_evaluations_setups_filter_task(self):
263263
self.use_production_server()

tests/test_flows/test_flow.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def setUp(self):
4444
def tearDown(self):
4545
super().tearDown()
4646

47-
@pytest.mark.production()
47+
@pytest.mark.production_server()
4848
def test_get_flow(self):
4949
# We need to use the production server here because 4024 is not the
5050
# test server
@@ -77,7 +77,7 @@ def test_get_flow(self):
7777
assert subflow_3.parameters["L"] == "-1"
7878
assert len(subflow_3.components) == 0
7979

80-
@pytest.mark.production()
80+
@pytest.mark.production_server()
8181
@pytest.mark.xfail(reason="failures_issue_1544", strict=False)
8282
def test_get_structure(self):
8383
# also responsible for testing: flow.get_subflow
@@ -565,7 +565,7 @@ def test_extract_tags(self):
565565
tags = openml.utils.extract_xml_tags("oml:tag", flow_dict["oml:flow"])
566566
assert tags == ["OpenmlWeka", "weka"]
567567

568-
@pytest.mark.production()
568+
@pytest.mark.production_server()
569569
def test_download_non_scikit_learn_flows(self):
570570
self.use_production_server()
571571

tests/test_flows/test_flow_functions.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _check_flow(self, flow):
4747
)
4848
assert ext_version_str_or_none
4949

50-
@pytest.mark.production()
50+
@pytest.mark.production_server()
5151
def test_list_flows(self):
5252
self.use_production_server()
5353
# We can only perform a smoke test here because we test on dynamic
@@ -58,7 +58,7 @@ def test_list_flows(self):
5858
for flow in flows.to_dict(orient="index").values():
5959
self._check_flow(flow)
6060

61-
@pytest.mark.production()
61+
@pytest.mark.production_server()
6262
def test_list_flows_output_format(self):
6363
self.use_production_server()
6464
# We can only perform a smoke test here because we test on dynamic
@@ -67,21 +67,21 @@ def test_list_flows_output_format(self):
6767
assert isinstance(flows, pd.DataFrame)
6868
assert len(flows) >= 1500
6969

70-
@pytest.mark.production()
70+
@pytest.mark.production_server()
7171
def test_list_flows_empty(self):
7272
self.use_production_server()
7373
flows = openml.flows.list_flows(tag="NoOneEverUsesThisTag123")
7474
assert flows.empty
7575

76-
@pytest.mark.production()
76+
@pytest.mark.production_server()
7777
def test_list_flows_by_tag(self):
7878
self.use_production_server()
7979
flows = openml.flows.list_flows(tag="weka")
8080
assert len(flows) >= 5
8181
for flow in flows.to_dict(orient="index").values():
8282
self._check_flow(flow)
8383

84-
@pytest.mark.production()
84+
@pytest.mark.production_server()
8585
def test_list_flows_paginate(self):
8686
self.use_production_server()
8787
size = 10
@@ -301,7 +301,7 @@ def test_sklearn_to_flow_list_of_lists(self):
301301
assert server_flow.parameters["categories"] == "[[0, 1], [0, 1]]"
302302
assert server_flow.model.categories == flow.model.categories
303303

304-
@pytest.mark.production()
304+
@pytest.mark.production_server()
305305
def test_get_flow1(self):
306306
# Regression test for issue #305
307307
# Basically, this checks that a flow without an external version can be loaded
@@ -338,7 +338,7 @@ def test_get_flow_reinstantiate_model_no_extension(self):
338338
Version(sklearn.__version__) == Version("0.19.1"),
339339
reason="Requires scikit-learn!=0.19.1, because target flow is from that version.",
340340
)
341-
@pytest.mark.production()
341+
@pytest.mark.production_server()
342342
def test_get_flow_with_reinstantiate_strict_with_wrong_version_raises_exception(self):
343343
self.use_production_server()
344344
flow = 8175
@@ -359,7 +359,7 @@ def test_get_flow_with_reinstantiate_strict_with_wrong_version_raises_exception(
359359
# Because scikit-learn dropped min_impurity_split hyperparameter in 1.0,
360360
# and the requested flow is from 1.0.0 exactly.
361361
)
362-
@pytest.mark.production()
362+
@pytest.mark.production_server()
363363
def test_get_flow_reinstantiate_flow_not_strict_post_1(self):
364364
self.use_production_server()
365365
flow = openml.flows.get_flow(flow_id=19190, reinstantiate=True, strict_version=False)
@@ -373,7 +373,7 @@ def test_get_flow_reinstantiate_flow_not_strict_post_1(self):
373373
reason="Requires scikit-learn 0.23.2 or ~0.24.",
374374
# Because these still have min_impurity_split, but with new scikit-learn module structure."
375375
)
376-
@pytest.mark.production()
376+
@pytest.mark.production_server()
377377
def test_get_flow_reinstantiate_flow_not_strict_023_and_024(self):
378378
self.use_production_server()
379379
flow = openml.flows.get_flow(flow_id=18587, reinstantiate=True, strict_version=False)
@@ -385,7 +385,7 @@ def test_get_flow_reinstantiate_flow_not_strict_023_and_024(self):
385385
Version(sklearn.__version__) > Version("0.23"),
386386
reason="Requires scikit-learn<=0.23, because the scikit-learn module structure changed.",
387387
)
388-
@pytest.mark.production()
388+
@pytest.mark.production_server()
389389
def test_get_flow_reinstantiate_flow_not_strict_pre_023(self):
390390
self.use_production_server()
391391
flow = openml.flows.get_flow(flow_id=8175, reinstantiate=True, strict_version=False)

tests/test_openml/test_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_setup_with_config(self):
106106

107107

108108
class TestConfigurationForExamples(openml.testing.TestBase):
109-
@pytest.mark.production()
109+
@pytest.mark.production_server()
110110
def test_switch_to_example_configuration(self):
111111
"""Verifies the test configuration is loaded properly."""
112112
# Below is the default test key which would be used anyway, but just for clarity:
@@ -118,7 +118,7 @@ def test_switch_to_example_configuration(self):
118118
assert openml.config.apikey == TestBase.user_key
119119
assert openml.config.server == self.test_server
120120

121-
@pytest.mark.production()
121+
@pytest.mark.production_server()
122122
def test_switch_from_example_configuration(self):
123123
"""Verifies the previous configuration is loaded after stopping."""
124124
# Below is the default test key which would be used anyway, but just for clarity:
@@ -143,7 +143,7 @@ def test_example_configuration_stop_before_start(self):
143143
openml.config.stop_using_configuration_for_example,
144144
)
145145

146-
@pytest.mark.production()
146+
@pytest.mark.production_server()
147147
def test_example_configuration_start_twice(self):
148148
"""Checks that the original config can be returned to if `start..` is called twice."""
149149
openml.config.apikey = TestBase.user_key

0 commit comments

Comments
 (0)