diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9fe470e9..93df5496 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -52,7 +52,8 @@ jobs: # This is very dubious... It *may* work because these are just cpp libraries that should not depend on the python version. Still, super-dubious. CIBW_BEFORE_BUILD_WINDOWS: "python -m pip install delvewheel" CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "python -m delvewheel repair --no-mangle-all --add-path build\\temp.win-amd64-3.6\\Release;build\\temp.win-amd64-3.6\\Release\\Release;build\\temp.win-amd64-3.6\\Release\\_deps\\gmp-src\\lib;build\\temp.win-amd64-3.6\\Release\\_deps\\mpfr-src\\lib -w {dest_dir} {wheel} " - CIBW_TEST_COMMAND: "python {project}/tests/test_basic.py {project}/data/" + CIBW_TEST_REQUIRES: "gitpython" + CIBW_TEST_COMMAND: "python {project}/tests/test_basic.py" CIBW_BUILD: "${{ matrix.cpversion }}-${{ matrix.os.cibw-arch }}" CIBW_TEST_SKIP: "*-macosx_arm64" CIBW_ENVIRONMENT: "MAX_JOBS=2" diff --git a/CMakeLists.txt b/CMakeLists.txt index 93276ee0..094afe21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,9 +15,6 @@ include(Warnings) # Use C++11/14 include(CXXFeatures) -option(PY_IGL_DOWNLOAD_TEST_DATA "Download test data" ON) -option(PY_IGL_DOWNLOAD_TUTORIAL_DATA "Download tutorial data" ON) - # Generate position independent code by default set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE INTERNAL "") diff --git a/README.md b/README.md index 614cfca4..ee8518c8 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,9 @@ or python tests/test_basic.py ``` +and if developing and trying to run from this directory. You could use: + +``` +PYTHONPATH=. python tests/test_basic.py +``` + diff --git a/cmake/PyiglDependencies.cmake b/cmake/PyiglDependencies.cmake index da6705c9..da07e264 100644 --- a/cmake/PyiglDependencies.cmake +++ b/cmake/PyiglDependencies.cmake @@ -45,20 +45,3 @@ SET(NPE_WITH_EIGEN "${libigl_SOURCE_DIR}/../eigen-src/" CACHE INTERNAL "") include(numpyeigen) # Pop CMAKE_MODULE_PATH set(CMAKE_MODULE_PATH ${PREV_CMAKE_MODULE_PATH}) - -if(${PY_IGL_DOWNLOAD_TEST_DATA}) - FetchContent_Declare(test_data - SOURCE_DIR "${PYLIBIGL_EXTERNAL}/../data" - GIT_REPOSITORY https://github.com/libigl/libigl-tests-data.git - GIT_TAG 19cedf96d70702d8b3a83eb27934780c542356fe) - FetchContent_MakeAvailable(test_data) -endif() - -if(${PY_IGL_DOWNLOAD_TUTORIAL_DATA}) - FetchContent_Declare(tutorial_data - SOURCE_DIR "${PYLIBIGL_EXTERNAL}/../tutorial/data" - GIT_REPOSITORY https://github.com/libigl/libigl-tutorial-data.git - GIT_TAG c1f9ede366d02e3531ecbaec5e3769312f31cccd) - FetchContent_MakeAvailable(tutorial_data) -endif() - diff --git a/tests/test_basic.py b/tests/test_basic.py index 5cfcb4b1..a05b9310 100644 --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -8,6 +8,8 @@ import scipy.sparse as csc import math import sys +from git import Repo + @@ -18,14 +20,17 @@ class TestBasic(unittest.TestCase): - test_data_path = None def setUp(self): + # This is called once for every sub-test. + # Some global datastructures to use in the tests np.random.seed(42) - if self.test_data_path is None: - self.test_data_path = os.path.join(os.path.dirname( - os.path.realpath(__file__)), "../data/") + # https://stackoverflow.com/a/45230996/148668 + self.test_data_path = os.path.join("./data","") + if not os.path.isdir(self.test_data_path): + Repo.clone_from("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/libigl/libigl-tests-data.git", self.test_data_path) + self.v1, self.f1 = igl.read_triangle_mesh( os.path.join(self.test_data_path, "bunny_small.off")) self.v2, self.f2 = igl.read_triangle_mesh( @@ -490,7 +495,6 @@ def test_read_dmat(self): # sparse matrix, no flag attribute def test_vector_area_matrix(self): a = igl.vector_area_matrix(self.f) - self.assertEqual(a.dtype, self.f.dtype) self.assertEqual(a.shape[0], a.shape[1]) self.assertEqual(a.shape[0], self.v.shape[0]*2) @@ -2463,8 +2467,5 @@ def test_flip_edge(self): emap.dtype == self.f1.dtype) self.assertTrue(np.array(ue2e).dtype == self.f1.dtype) - if __name__ == '__main__': - if len(sys.argv) > 1: - TestBasic.test_data_path = os.path.join(sys.argv.pop(),'') unittest.main() diff --git a/tutorial/tutorials.ipynb b/tutorial/tutorials.ipynb index fb92cb43..c65ebe9b 100644 --- a/tutorial/tutorials.ipynb +++ b/tutorial/tutorials.ipynb @@ -70,7 +70,13 @@ "\n", "import os\n", "root_folder = os.getcwd()\n", - "#root_folder = os.path.join(os.getcwd(), \"tutorial\")" + "#root_folder = os.path.join(os.getcwd(), \"tutorial\")", + "data_folder = os.path.join(root_folder,\"/data\")\n", + "# pip install gitpython\n", + "from git import Repo\n", + "if not os.path.isdir(data_folder):\n" + " Repo.clone_from(\"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/libigl/libigl-tutorial-data.git\", data_folder)\n", + "\n" ] }, {