Skip to content

Commit fe76586

Browse files
committed
numpy version for travis and fix test on vtk files
1 parent 6a99201 commit fe76586

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ install:
6161
- echo $LD_LIBRARY_PATH
6262
- echo $DYLD_LIBRARY_PATH
6363
- echo $PATH
64-
- conda install numpy scipy matplotlib vtk nose setuptools coveralls
64+
- conda install "numpy>=1.12" scipy matplotlib vtk nose setuptools coveralls
6565
- if [[ "$TOXENV" == "py27" ]]; then
6666
conda install --yes -c conda-forge -c dlr-sc -c pythonocc -c oce pythonocc-core=0.17 python=2.7;
6767
else

tests/test_ffdparams.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ def test_write_parameters(self):
328328
outfilename = 'tests/test_datasets/parameters_sphere_out.prm'
329329
outfilename_expected = 'tests/test_datasets/parameters_sphere_out_true.prm'
330330
params.write_parameters(outfilename)
331-
332331
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
333332
os.remove(outfilename)
334333

@@ -339,7 +338,8 @@ def test_save_points(self):
339338
outfilename = 'tests/test_datasets/box_test_sphere_out.vtk'
340339
outfilename_expected = 'tests/test_datasets/box_test_sphere.vtk'
341340
params.save_points(outfilename, False)
342-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
341+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
342+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
343343
os.remove(outfilename)
344344

345345
def test_save_points_deformed(self):
@@ -349,7 +349,8 @@ def test_save_points_deformed(self):
349349
outfilename = 'tests/test_datasets/box_test_sphere_deformed_out.vtk'
350350
outfilename_expected = 'tests/test_datasets/box_test_sphere_deformed.vtk'
351351
params.save_points(outfilename, True)
352-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
352+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
353+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
353354
os.remove(outfilename)
354355

355356
def test_print(self):

tests/test_rbfparams.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def test_save_points(self):
7676
outfilename = 'tests/test_datasets/box_test_cube_out.vtk'
7777
outfilename_expected = 'tests/test_datasets/box_test_cube.vtk'
7878
params.save_points(outfilename, False)
79-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
79+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
80+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
8081
os.remove(outfilename)
8182

8283
def test_save_points_deformed(self):
@@ -86,7 +87,8 @@ def test_save_points_deformed(self):
8687
outfilename = 'tests/test_datasets/box_test_cube_deformed_out.vtk'
8788
outfilename_expected = 'tests/test_datasets/box_test_cube_deformed.vtk'
8889
params.save_points(outfilename, True)
89-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
90+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
91+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
9092
os.remove(outfilename)
9193

9294
def test_write_parameters_failing_filename_type(self):

tests/test_stlhandler.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ def test_stl_write_comparison(self):
120120
outfilename_expected = 'tests/test_datasets/test_sphere_out_true.stl'
121121

122122
stl_handler.write(mesh_points, outfilename)
123-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
123+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
124+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
124125
self.addCleanup(os.remove, outfilename)
125126

126127
def test_stl_write_binary_from_binary(self):
@@ -178,7 +179,8 @@ def test_stl_write_ascii_from_binary(self):
178179
outfilename_expected = 'tests/test_datasets/test_sphere_out_true.stl'
179180

180181
stl_handler.write(mesh_points, outfilename, write_bin=False)
181-
self.assertTrue(filecmp.cmp(outfilename, outfilename_expected))
182+
with open(outfilename, 'r') as out, open(outfilename_expected, 'r') as exp:
183+
self.assertTrue(out.readlines()[1:] == exp.readlines()[1:])
182184
self.addCleanup(os.remove, outfilename)
183185

184186
def test_stl_plot_save_fig(self):

0 commit comments

Comments
 (0)