Skip to content

Commit d7d9d10

Browse files
committed
Check if config file exists when running unit tests.
1 parent 19284f0 commit d7d9d10

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

openml/apiconnector.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ def _parse_config(self):
237237
'private_directory': os.path.expanduser('~/.openml/private')}
238238

239239
config_file = os.path.expanduser('~/.openml/config')
240+
# Save the config file to check its existence at test time
241+
self.config_file = config_file
240242
config = configparser.RawConfigParser(defaults=defaults)
241243

242244
if not os.path.exists(config_file):

tests/test_apiconnector.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ def setUp(self):
4343
self.connector = APIConnector(cache_directory=self.workdir)
4444
print(self.connector._session_hash)
4545

46+
if not os.path.exists(self.connector.config_file):
47+
raise Exception("OpenML config file required to run unit tests. "
48+
"See https://github.com/openml/OpenML/wiki/Client-API")
49+
4650
def tearDown(self):
4751
os.chdir(self.cwd)
4852
shutil.rmtree(self.workdir)

0 commit comments

Comments
 (0)