1414
1515import openml .config
1616import openml .testing
17+ from openml .testing import TestBase
1718
1819
1920@contextmanager
@@ -76,7 +77,7 @@ def test_get_config_as_dict(self):
7677 """Checks if the current configuration is returned accurately as a dict."""
7778 config = openml .config .get_config_as_dict ()
7879 _config = {}
79- _config ["apikey" ] = "610344db6388d9ba34f6db45a3cf71de"
80+ _config ["apikey" ] = TestBase . user_key
8081 _config ["server" ] = "https://test.openml.org/api/v1/xml"
8182 _config ["cachedir" ] = self .workdir
8283 _config ["avoid_duplicate_runs" ] = False
@@ -90,7 +91,7 @@ def test_get_config_as_dict(self):
9091 def test_setup_with_config (self ):
9192 """Checks if the OpenML configuration can be updated using _setup()."""
9293 _config = {}
93- _config ["apikey" ] = "610344db6388d9ba34f6db45a3cf71de"
94+ _config ["apikey" ] = TestBase . user_key
9495 _config ["server" ] = "https://www.openml.org/api/v1/xml"
9596 _config ["cachedir" ] = self .workdir
9697 _config ["avoid_duplicate_runs" ] = True
@@ -109,25 +110,25 @@ class TestConfigurationForExamples(openml.testing.TestBase):
109110 def test_switch_to_example_configuration (self ):
110111 """Verifies the test configuration is loaded properly."""
111112 # Below is the default test key which would be used anyway, but just for clarity:
112- openml .config .apikey = "610344db6388d9ba34f6db45a3cf71de"
113+ openml .config .apikey = TestBase . admin_key
113114 openml .config .server = self .production_server
114115
115116 openml .config .start_using_configuration_for_example ()
116117
117- assert openml .config .apikey == "c0c42819af31e706efe1f4b88c23c6c1"
118+ assert openml .config .apikey == TestBase . user_key
118119 assert openml .config .server == self .test_server
119120
120121 @pytest .mark .production ()
121122 def test_switch_from_example_configuration (self ):
122123 """Verifies the previous configuration is loaded after stopping."""
123124 # Below is the default test key which would be used anyway, but just for clarity:
124- openml .config .apikey = "610344db6388d9ba34f6db45a3cf71de"
125+ openml .config .apikey = TestBase . user_key
125126 openml .config .server = self .production_server
126127
127128 openml .config .start_using_configuration_for_example ()
128129 openml .config .stop_using_configuration_for_example ()
129130
130- assert openml .config .apikey == "610344db6388d9ba34f6db45a3cf71de"
131+ assert openml .config .apikey == TestBase . user_key
131132 assert openml .config .server == self .production_server
132133
133134 def test_example_configuration_stop_before_start (self ):
@@ -145,14 +146,14 @@ def test_example_configuration_stop_before_start(self):
145146 @pytest .mark .production ()
146147 def test_example_configuration_start_twice (self ):
147148 """Checks that the original config can be returned to if `start..` is called twice."""
148- openml .config .apikey = "610344db6388d9ba34f6db45a3cf71de"
149+ openml .config .apikey = TestBase . user_key
149150 openml .config .server = self .production_server
150151
151152 openml .config .start_using_configuration_for_example ()
152153 openml .config .start_using_configuration_for_example ()
153154 openml .config .stop_using_configuration_for_example ()
154155
155- assert openml .config .apikey == "610344db6388d9ba34f6db45a3cf71de"
156+ assert openml .config .apikey == TestBase . user_key
156157 assert openml .config .server == self .production_server
157158
158159
0 commit comments