Skip to content

Commit 76522ab

Browse files
committed
fix CI
1 parent d110fff commit 76522ab

6 files changed

Lines changed: 40 additions & 25 deletions

File tree

ci_scripts/install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ conda create -n testenv --yes python=$PYTHON_VERSION pip
2828
source activate testenv
2929
pip install nose numpy scipy cython scikit-learn==$SKLEARN_VERSION oslo.concurrency
3030

31-
if [[ "EXAMPLES" == "true" ]]; then
32-
pip install matplotlib jupyter notebook nbconvert nbformat jupyter_client ipython \
33-
ipykernel pandas seaborn
31+
if [[ "$EXAMPLES" == "true" ]]; then
32+
pip install matplotlib jupyter notebook nbconvert nbformat jupyter_client \
33+
ipython ipykernel pandas seaborn
3434
fi
3535

3636
if [[ "$COVERAGE" == "true" ]]; then

ci_scripts/test.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ test_dir=$cwd/tests
99

1010
cd $TEST_DIR
1111

12-
if [[ "$COVERAGE" == "true" ]]; then
13-
nosetests --processes=4 --process-timeout=600 -sv --with-coverage --cover-package=$MODULE $test_dir
12+
if [[ "$EXAMPLES" == "true" ]]; then
13+
nosetests -sv $test_dir/test_examples/
14+
elif [[ "$COVERAGE" == "true" ]]; then
15+
nosetests --processes=4 --process-timeout=600 -sv --ignore-files="test_OpenMLDemo\.py" --with-coverage --cover-package=$MODULE $test_dir
1416
else
15-
nosetests --processes=4 --process-timeout=600 -sv $test_dir
17+
nosetests --processes=4 --process-timeout=600 -sv --ignore-files="test_OpenMLDemo\.py" $test_dir
1618
fi

openml/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
format='[%(levelname)s] [%(asctime)s:%(name)s] %('
1414
'message)s', datefmt='%H:%M:%S')
1515

16+
config_file = os.path.expanduser('~/.openml/config')
1617
server = "https://www.openml.org/api/v1/xml"
1718
apikey = ""
1819
cachedir = ""
@@ -70,7 +71,9 @@ def set_cache_directory(cachedir):
7071
run_cache_dir = os.path.join(cachedir, 'runs')
7172
lock_dir = os.path.join(cachedir, 'locks')
7273

73-
for dir_ in [cachedir, dataset_cache_dir, task_cache_dir, run_cache_dir]:
74+
for dir_ in [
75+
cachedir, dataset_cache_dir, task_cache_dir, run_cache_dir, lock_dir,
76+
]:
7477
if not os.path.exists(dir_) and not os.path.isdir(dir_):
7578
os.mkdir(dir_)
7679

@@ -84,7 +87,6 @@ def _parse_config():
8487
'cachedir': os.path.expanduser('~/.openml/cache'),
8588
'avoid_duplicate_runs': 'True'}
8689

87-
config_file = os.path.expanduser('~/.openml/config')
8890
config = configparser.RawConfigParser(defaults=defaults)
8991

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

openml/testing.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import time
66
import unittest
77

8+
from oslo_concurrency import lockutils
89
import six
910

1011
import openml
@@ -56,6 +57,13 @@ def setUp(self):
5657

5758
openml.config.set_cache_directory(self.workdir)
5859

60+
# If we're on travis, we save the api key in the config file to allow
61+
# the notebook tests to read them.
62+
if os.environ.get('TRAVIS'):
63+
with lockutils.external_lock('config', lock_path=self.workdir):
64+
with open(openml.config.config_file, 'w') as fh:
65+
fh.write('apikey = %s' % openml.config.apikey)
66+
5967
def tearDown(self):
6068
os.chdir(self.cwd)
6169
shutil.rmtree(self.workdir)

tests/test_examples/test_OpenMLDemo.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
import os
2-
import unittest
32
import shutil
43
import sys
54

65
import nbformat
76
from nbconvert.preprocessors import ExecutePreprocessor
87
from nbconvert.preprocessors.execute import CellExecutionError
98

9+
from openml.testing import TestBase
1010

11-
class OpenMLDemoTest(unittest.TestCase):
11+
12+
class OpenMLDemoTest(TestBase):
1213
def setUp(self):
14+
super(OpenMLDemoTest, self).setUp()
15+
1316
python_version = sys.version_info[0]
1417
self.kernel_name = 'python%d' % python_version
1518
self.this_file_directory = os.path.dirname(__file__)
@@ -37,7 +40,7 @@ def _test_notebook(self, notebook_name):
3740
nb = nbformat.read(f, as_version=4)
3841
nb.metadata.get('kernelspec', {})['name'] = self.kernel_name
3942
ep = ExecutePreprocessor(kernel_name=self.kernel_name)
40-
ep.timeout = 60
43+
ep.timeout = 180
4144

4245
try:
4346
ep.preprocess(nb, {'metadata': {'path': self.this_file_directory}})

tests/test_runs/test_run_functions.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -756,22 +756,22 @@ def test__create_trace_from_arff(self):
756756
def test_get_run(self):
757757
# this run is not available on test
758758
openml.config.server = self.production_server
759-
run = openml.runs.get_run(473344)
760-
self.assertEqual(run.dataset_id, 1167)
761-
self.assertEqual(run.evaluations['f_measure'], 0.624668)
762-
for i, value in [(0, 0.66233),
763-
(1, 0.639286),
764-
(2, 0.567143),
765-
(3, 0.745833),
766-
(4, 0.599638),
767-
(5, 0.588801),
768-
(6, 0.527976),
769-
(7, 0.666365),
770-
(8, 0.56759),
771-
(9, 0.64621)]:
759+
run = openml.runs.get_run(473351)
760+
self.assertEqual(run.dataset_id, 357)
761+
self.assertEqual(run.evaluations['f_measure'], 0.841225)
762+
for i, value in [(0, 0.840918),
763+
(1, 0.839458),
764+
(2, 0.839613),
765+
(3, 0.842571),
766+
(4, 0.839567),
767+
(5, 0.840922),
768+
(6, 0.840985),
769+
(7, 0.847129),
770+
(8, 0.84218),
771+
(9, 0.844014)]:
772772
self.assertEqual(run.fold_evaluations['f_measure'][0][i], value)
773773
assert('weka' in run.tags)
774-
assert('stacking' in run.tags)
774+
assert('weka_3.7.12' in run.tags)
775775

776776
def _check_run(self, run):
777777
self.assertIsInstance(run, dict)

0 commit comments

Comments
 (0)