Skip to content

Commit 20ee072

Browse files
committed
changed test to use latest backed style
Signed-off-by: Omswastik-11 <omswastikpanda11@gmail.com>
1 parent ff33d8e commit 20ee072

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

tests/test_runs/test_run_functions.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
OpenMLNotAuthorizedError,
4242
OpenMLServerException,
4343
)
44-
from openml._api import api_context
4544
from openml._api.config import settings
4645
#from openml.extensions.sklearn import cat, cont
4746
from openml.runs.functions import (
@@ -1670,12 +1669,13 @@ def test_get_cached_run(self):
16701669
previous_cache_dir = settings.cache.dir
16711670
try:
16721671
settings.cache.dir = str(self.workdir / "http_cache_runs")
1673-
api_context.set_version("v1", strict=False)
1672+
openml._backend.set_config_value("api_version", "v1")
1673+
openml._backend.set_config_value("fallback_api_version", "v1")
16741674

16751675
run = openml.runs.get_run(1)
16761676
assert run.run_id == 1
16771677

1678-
http_client = api_context.backend.runs._http
1678+
http_client = openml._backend.run._http
16791679
assert http_client.cache is not None
16801680

16811681
url = urljoin(
@@ -1690,18 +1690,20 @@ def test_get_cached_run(self):
16901690
assert (cache_path / "body.bin").exists()
16911691
finally:
16921692
settings.cache.dir = previous_cache_dir
1693-
api_context.set_version("v1", strict=False)
1693+
openml._backend.set_config_value("api_version", "v1")
1694+
openml._backend.set_config_value("fallback_api_version", "v1")
16941695

16951696
def test_get_uncached_run(self):
16961697
previous_cache_dir = settings.cache.dir
16971698
try:
16981699
settings.cache.dir = str(self.workdir / "http_cache_runs_uncached")
1699-
api_context.set_version("v1", strict=False)
1700+
openml._backend.set_config_value("api_version", "v1")
1701+
openml._backend.set_config_value("fallback_api_version", "v1")
17001702

17011703
run = openml.runs.get_run(1)
17021704
assert run.run_id == 1
17031705

1704-
http_client = api_context.backend.runs._http
1706+
http_client = openml._backend.run._http
17051707
assert http_client.cache is not None
17061708

17071709
url = urljoin(
@@ -1716,7 +1718,8 @@ def test_get_uncached_run(self):
17161718
assert (cache_path / "body.bin").exists()
17171719
finally:
17181720
settings.cache.dir = previous_cache_dir
1719-
api_context.set_version("v1", strict=False)
1721+
openml._backend.set_config_value("api_version", "v1")
1722+
openml._backend.set_config_value("fallback_api_version", "v1")
17201723

17211724
@pytest.mark.sklearn()
17221725
@pytest.mark.uses_test_server()

0 commit comments

Comments
 (0)