Skip to content

Commit

Permalink
Alabaster in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
choldgraf committed Oct 28, 2023
1 parent 90207a4 commit 3590644
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class SphinxBuild:
path_pg_index = path_html.joinpath("index.html")
path_pg_config = path_html.joinpath("configure.html")
path_pg_ntbk = path_html.joinpath("examples/notebooks.html")
cmd_base = ["sphinx-build", ".", "_build/html", "-a", "-W"]
# Test using our documentation but the Alabaster theme
# this avoids version pinning clashes with the Book Theme
cmd_base = ["sphinx-build", ".", "_build/html", "-D", "html_theme=alabaster", "-a"]

def copy(self, path=None):
"""Copy the specified book to our tests folder for building."""
Expand All @@ -34,7 +36,8 @@ def copy(self, path=None):
def build(self, cmd=None):
"""Build the test book"""
cmd = [] if cmd is None else cmd
run(self.cmd_base + cmd, cwd=self.path_tmp_docs, check=True)
output = run(self.cmd_base + cmd, cwd=self.path_tmp_docs, check=True, capture_output=True)
self.output = output

def clean(self):
"""Clean the _build folder so files don't clash with new tests."""
Expand All @@ -50,6 +53,10 @@ def test_sphinx_thebe(file_regression, sphinx_build):
# Basic build with defaults
sphinx_build.build()

# No build warnings that were raised by sphinx-thebe
errors = list(sphinx_build.output.stderr.decode().split("\n"))
assert all(["[sphinx-thebe]" not in ii for ii in errors])

# Testing index for base config
soup_ix = BeautifulSoup(Path(sphinx_build.path_pg_index).read_text(), "html.parser")
config = soup_ix("script", {"type": "text/x-thebe-config"})
Expand Down

0 comments on commit 3590644

Please sign in to comment.