Skip to content

Commit 7a11014

Browse files
authored
Reduce qr test-cases (#395)
1 parent e088b3e commit 7a11014

29 files changed

+89
-61
lines changed

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ COPY . dislib/
55

66
ENV PYTHONPATH=$PYTHONPATH:/dislib
77
ENV LC_ALL=C.UTF-8
8-
RUN pip3 install -r /dislib/requirements.txt
8+
RUN python3 -m pip install --upgrade -r /dislib/requirements.txt
9+
10+
ENV COMPSS_LOAD_SOURCE false
911

1012
# Expose SSH port and run SSHD
1113
EXPOSE 22

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pipeline {
2222
stage('build') {
2323
steps {
2424
setGithubCommitStatus('pending', 'The Jenkins build is in progress')
25-
sh 'git lfs pull origin'
25+
sh 'git pull origin'
2626
sh 'docker rm -f dislib &> /dev/null || true'
2727
sh 'docker rmi -f bscwdc/dislib &> /dev/null || true'
2828
sh 'docker build --pull --no-cache --tag bscwdc/dislib .'

dislib/data/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ def _read_svmlight(lines, out_blocks, col_size, n_features, store_sparse):
481481
tmp_file.writelines(lines)
482482
tmp_file.seek(0)
483483

484-
x, y = load_svmlight_file(tmp_file, n_features)
484+
x, y = load_svmlight_file(tmp_file, n_features=n_features)
485485
if not store_sparse:
486486
x = x.toarray()
487487

requirements.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
scikit-learn>=0.22.1, <=0.24.1
1+
scikit-learn>=1.1.1
22
scipy>=1.3.0
3-
numpy>=1.18.1, <=1.19.5
3+
numpy>=1.18.1
44
numpydoc>=0.8.0
55
cvxpy>=1.1.5
6-
cbor2>=5.4.0
6+
cbor2>=5.4.0
7+
pandas>=0.24.2
8+
matplotlib>=2.2.3

tests/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from time import time
2+
import unittest
3+
4+
5+
class BaseTimedTestCase(unittest.TestCase):
6+
def setUp(self):
7+
self.start_time = time()
8+
9+
def tearDown(self):
10+
self.end_time = time()
11+
print("Test %s took: %.3f seconds" %
12+
(self.id(), self.end_time - self.start_time))

tests/test_als.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import dislib as ds
77
from dislib.recommendation import ALS
88
import dislib.data.util.model as utilmodel
9+
from tests import BaseTimedTestCase
910

1011

1112
def load_movielens(train_ratio=0.9):
@@ -42,7 +43,7 @@ def load_movielens(train_ratio=0.9):
4243
return train_arr, test_arr
4344

4445

45-
class ALSTest(unittest.TestCase):
46+
class ALSTest(BaseTimedTestCase):
4647
def test_init_params(self):
4748
# Test all parameters
4849
seed = 666

tests/test_array.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pandas as pd
1010
import dislib as ds
1111
from math import ceil
12+
from tests import BaseTimedTestCase
1213

1314

1415
def _sum_and_mult(arr, a=0, axis=0, b=1):
@@ -91,7 +92,7 @@ def _gen_irregular_arrays(fmt, shape=None, block_size=None):
9192
return x[1:, 1:], x_sp[1:, 1:]
9293

9394

94-
class DataLoadingTest(unittest.TestCase):
95+
class DataLoadingTest(BaseTimedTestCase):
9596

9697
@parameterized.expand([(_gen_random_arrays("dense", (6, 10), (4, 3))
9798
+ ((6, 10), (4, 3))),
@@ -295,7 +296,7 @@ def test_load_mdcrd_file(self):
295296
self.assertTrue(_validate_array(x))
296297

297298

298-
class LoadBlocksRechunkTest(unittest.TestCase):
299+
class LoadBlocksRechunkTest(BaseTimedTestCase):
299300
def test_rechunk_new_block_size_exception(self):
300301
""" Tests that load_blocks_rechunk function throws an exception
301302
when the block_size returned of the rechunk is greater than the shape
@@ -347,7 +348,7 @@ def test_rechunk_block_size_exception(self):
347348
ds.data.load_blocks_rechunk(blocks, (20, 20), (25, 25), (5, 5))
348349

349350

350-
class LoadHStackNpyFilesTest(unittest.TestCase):
351+
class LoadHStackNpyFilesTest(BaseTimedTestCase):
351352
folder = 'load_hstack_npy_files_test_folder'
352353
arrays = [np.random.rand(3, 4) for _ in range(5)]
353354

@@ -372,7 +373,7 @@ def test_load_hstack_npy_files_2(self):
372373
self.assertTrue(np.allclose(x.collect(), np.hstack(self.arrays)))
373374

374375

375-
class SaveTxtTest(unittest.TestCase):
376+
class SaveTxtTest(BaseTimedTestCase):
376377
folder = 'save_txt_test_folder'
377378

378379
def tearDown(self):
@@ -408,7 +409,7 @@ def test_save_txt_merge_rows(self, x, x_np):
408409
self.assertTrue(_equal_arrays(np.vstack(h_blocks), x_np))
409410

410411

411-
class SaveNpyTest(unittest.TestCase):
412+
class SaveNpyTest(BaseTimedTestCase):
412413
folder = 'save_npy_test_folder'
413414

414415
def tearDown(self):
@@ -454,7 +455,7 @@ def test_load_npy_files(self):
454455
ds.data.load_npy_files('save_npy_test_folder')
455456

456457

457-
class ArrayTest(unittest.TestCase):
458+
class ArrayTest(BaseTimedTestCase):
458459

459460
@parameterized.expand([_gen_random_arrays("dense"),
460461
_gen_random_arrays("sparse")])
@@ -1086,7 +1087,7 @@ def test_median(self):
10861087
x_csr.median()
10871088

10881089

1089-
class MathTest(unittest.TestCase):
1090+
class MathTest(BaseTimedTestCase):
10901091

10911092
@parameterized.expand([((21, 33), (10, 15), False),
10921093
((5, 10), (8, 1), False),

tests/test_csvm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
import dislib as ds
99
from dislib.classification import CascadeSVM
1010
import dislib.data.util.model as utilmodel
11+
from tests import BaseTimedTestCase
1112

1213

13-
class CSVMTest(unittest.TestCase):
14+
class CSVMTest(BaseTimedTestCase):
1415
def test_init_params(self):
1516
""" Test constructor parameters"""
1617
cascade_arity = 3

tests/test_data_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
from dislib.data.util import pad, pad_last_blocks_with_zeros, \
77
compute_bottom_right_shape, remove_last_columns, sync_obj
88

9+
from tests import BaseTimedTestCase
910

10-
class DataUtilsTest(unittest.TestCase):
11+
12+
class DataUtilsTest(BaseTimedTestCase):
1113

1214
@parameterized.expand([
1315
((3, 4), (3, 3), (3, 1)),

tests/test_daura.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
import unittest
2-
31
import numpy as np
42

53
import dislib as ds
64
from dislib.cluster import Daura
5+
from tests import BaseTimedTestCase
76

87

9-
class GaussianMixtureTest(unittest.TestCase):
8+
class GaussianMixtureTest(BaseTimedTestCase):
109

1110
def test_init_params(self):
1211
"""Tests that Daura fit_predict"""

0 commit comments

Comments
 (0)