Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
53 lines (42 loc) · 1.59 KB

File metadata and controls

53 lines (42 loc) · 1.59 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import inspect
import os
import shutil
import unittest
import openml
class TestBase(unittest.TestCase):
"""Base class for tests
Note
----
Currently hard-codes a read-write key.
Hopefully soon allows using a test server, not the production server.
"""
def setUp(self):
# This cache directory is checked in to git to simulate a populated
# cache
self.static_cache_dir = None
static_cache_dir = os.path.dirname(os.path.abspath(inspect.getfile(self.__class__)))
static_cache_dir = os.path.abspath(os.path.join(static_cache_dir, '..'))
content = os.listdir(static_cache_dir)
if 'files' in content:
self.static_cache_dir = os.path.join(static_cache_dir, 'files')
if self.static_cache_dir is None:
raise ValueError('Cannot find test cache dir!')
self.cwd = os.getcwd()
workdir = os.path.dirname(os.path.abspath(__file__))
self.workdir = os.path.join(workdir, "tmp")
try:
shutil.rmtree(self.workdir)
except:
pass
os.mkdir(self.workdir)
os.chdir(self.workdir)
self.cached = True
# amueller's read/write key that he will throw away later
openml.config.apikey = "610344db6388d9ba34f6db45a3cf71de"
#openml.config.server = "http://capa.win.tue.nl/api/v1/xml"
openml.config.server = "https://test.openml.org/api/v1/xml"
openml.config.set_cache_directory(self.workdir, self.workdir)
def tearDown(self):
os.chdir(self.cwd)
shutil.rmtree(self.workdir)
__all__ = ['TestBase']
Morty Proxy This is a proxified and sanitized view of the page, visit original site.