|
8 | 8 | import scipy.sparse as csc |
9 | 9 | import math |
10 | 10 | import sys |
| 11 | +from git import Repo |
| 12 | + |
11 | 13 |
|
12 | 14 |
|
13 | 15 |
|
|
18 | 20 |
|
19 | 21 |
|
20 | 22 | class TestBasic(unittest.TestCase): |
21 | | - test_data_path = None |
22 | 23 |
|
23 | 24 | def setUp(self): |
| 25 | + # This is called once for every sub-test. |
| 26 | + |
24 | 27 | # Some global datastructures to use in the tests |
25 | 28 | np.random.seed(42) |
26 | | - if self.test_data_path is None: |
27 | | - self.test_data_path = os.path.join(os.path.dirname( |
28 | | - os.path.realpath(__file__)), "../data/") |
| 29 | + # https://stackoverflow.com/a/45230996/148668 |
| 30 | + self.test_data_path = os.path.join("./data","") |
| 31 | + if not os.path.isdir(self.test_data_path): |
| 32 | + Repo.clone_from("https://github.com/libigl/libigl-tests-data.git", self.test_data_path) |
| 33 | + |
29 | 34 | self.v1, self.f1 = igl.read_triangle_mesh( |
30 | 35 | os.path.join(self.test_data_path, "bunny_small.off")) |
31 | 36 | self.v2, self.f2 = igl.read_triangle_mesh( |
@@ -490,7 +495,6 @@ def test_read_dmat(self): |
490 | 495 | # sparse matrix, no flag attribute |
491 | 496 | def test_vector_area_matrix(self): |
492 | 497 | a = igl.vector_area_matrix(self.f) |
493 | | - self.assertEqual(a.dtype, self.f.dtype) |
494 | 498 | self.assertEqual(a.shape[0], a.shape[1]) |
495 | 499 | self.assertEqual(a.shape[0], self.v.shape[0]*2) |
496 | 500 |
|
@@ -2463,8 +2467,5 @@ def test_flip_edge(self): |
2463 | 2467 | emap.dtype == self.f1.dtype) |
2464 | 2468 | self.assertTrue(np.array(ue2e).dtype == self.f1.dtype) |
2465 | 2469 |
|
2466 | | - |
2467 | 2470 | if __name__ == '__main__': |
2468 | | - if len(sys.argv) > 1: |
2469 | | - TestBasic.test_data_path = os.path.join(sys.argv.pop(),'') |
2470 | 2471 | unittest.main() |
0 commit comments