From 63664cc561d96db9844ab1b1a1051214c0b0265e Mon Sep 17 00:00:00 2001 From: adehecq <3285905+adehecq@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:46:16 +0100 Subject: [PATCH 1/4] Attempt to fix doc building issue on Mac --- .../analysis/point_extraction/reduction.py | 2 +- tests/test_doc.py | 26 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/examples/analysis/point_extraction/reduction.py b/examples/analysis/point_extraction/reduction.py index 32496554..5684b2c6 100644 --- a/examples/analysis/point_extraction/reduction.py +++ b/examples/analysis/point_extraction/reduction.py @@ -52,7 +52,7 @@ coords = rast.coords(grid=True) x_closest = rast.copy(new_array=coords[0]).value_at_coords(x=x_coords, y=y_coords).squeeze() y_closest = rast.copy(new_array=coords[1]).value_at_coords(x=x_coords, y=y_coords).squeeze() -from shapely import box +from shapely.geometry import box geometry = [ box(x - 2 * rast.res[0], y - 2 * rast.res[1], x + 2 * rast.res[0], y + 2 * rast.res[1]) diff --git a/tests/test_doc.py b/tests/test_doc.py index 3e6cc1bb..8c1ef2da 100644 --- a/tests/test_doc.py +++ b/tests/test_doc.py @@ -13,20 +13,16 @@ class TestDocs: def test_build(self) -> None: """Try building the documentation and see if it works.""" # Remove the build directory if it exists. + if os.path.isdir(os.path.join(self.docs_dir, "build/")): + shutil.rmtree(os.path.join(self.docs_dir, "build/")) - # Test only on Linux - if platform.system() == "Linux": - # Remove the build directory if it exists. - if os.path.isdir(os.path.join(self.docs_dir, "build/")): - shutil.rmtree(os.path.join(self.docs_dir, "build/")) + return_code = sphinx.cmd.build.main( + [ + "-j", + "1", + os.path.join(self.docs_dir, "source/"), + os.path.join(self.docs_dir, "build/"), + ] + ) - return_code = sphinx.cmd.build.main( - [ - "-j", - "1", - os.path.join(self.docs_dir, "source/"), - os.path.join(self.docs_dir, "build/"), - ] - ) - - assert return_code == 0 + assert return_code == 0 From e565604a2d8c4d6d39e08d28dd03e0059a017477 Mon Sep 17 00:00:00 2001 From: adehecq <3285905+adehecq@users.noreply.github.com> Date: Wed, 17 Jan 2024 13:57:45 +0100 Subject: [PATCH 2/4] Remove unused import --- tests/test_doc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/test_doc.py b/tests/test_doc.py index 8c1ef2da..23073ec8 100644 --- a/tests/test_doc.py +++ b/tests/test_doc.py @@ -1,6 +1,5 @@ """Functions to test the documentation.""" import os -import platform import shutil import sphinx.cmd.build From 5c4c013f0eb97a8c5ac27ba2c555fe5fc22c07e1 Mon Sep 17 00:00:00 2001 From: adehecq <3285905+adehecq@users.noreply.github.com> Date: Thu, 18 Jan 2024 12:07:48 +0100 Subject: [PATCH 3/4] Remove fixed version of pydata-sphinx-theme --- dev-environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-environment.yml b/dev-environment.yml index 7b799bdc..f548898f 100644 --- a/dev-environment.yml +++ b/dev-environment.yml @@ -29,7 +29,7 @@ dependencies: # Doc dependencies - sphinx - - pydata-sphinx-theme==0.13.3 + - pydata-sphinx-theme - sphinx-book-theme>=1.0 - sphinx-gallery - sphinx-design From bb244ac9f5cb2d2ead85fc13528a753eeb5f99c9 Mon Sep 17 00:00:00 2001 From: adehecq <3285905+adehecq@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:07:55 +0100 Subject: [PATCH 4/4] Disable test_doc.py on Windows as it currently fails --- tests/test_doc.py | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/test_doc.py b/tests/test_doc.py index 23073ec8..28aa90d1 100644 --- a/tests/test_doc.py +++ b/tests/test_doc.py @@ -1,5 +1,6 @@ """Functions to test the documentation.""" import os +import platform import shutil import sphinx.cmd.build @@ -11,17 +12,21 @@ class TestDocs: def test_build(self) -> None: """Try building the documentation and see if it works.""" - # Remove the build directory if it exists. - if os.path.isdir(os.path.join(self.docs_dir, "build/")): - shutil.rmtree(os.path.join(self.docs_dir, "build/")) - - return_code = sphinx.cmd.build.main( - [ - "-j", - "1", - os.path.join(self.docs_dir, "source/"), - os.path.join(self.docs_dir, "build/"), - ] - ) - - assert return_code == 0 + + # Building the doc fails on Windows for the CLI section + if (platform.system() == "Linux") or (platform.system() == "Darwin"): + + # Remove the build directory if it exists. + if os.path.isdir(os.path.join(self.docs_dir, "build/")): + shutil.rmtree(os.path.join(self.docs_dir, "build/")) + + return_code = sphinx.cmd.build.main( + [ + "-j", + "1", + os.path.join(self.docs_dir, "source/"), + os.path.join(self.docs_dir, "build/"), + ] + ) + + assert return_code == 0