Skip to content

Commit b247c43

Browse files
committed
tests: add docfx
1 parent 9e16eab commit b247c43

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

packages/proto-plus/noxfile.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414

1515
from __future__ import absolute_import
1616

17+
import shutil
1718
import nox
19+
import os
1820
import pathlib
1921

2022

@@ -243,6 +245,53 @@ def docs(session):
243245
)
244246

245247

248+
@nox.session(python="3.10")
249+
def docfx(session):
250+
"""Build the docfx yaml files for this library."""
251+
252+
session.install("-e", ".")
253+
session.install(
254+
# We need to pin to specific versions of the `sphinxcontrib-*` packages
255+
# which still support sphinx 4.x.
256+
# See https://github.com/googleapis/sphinx-docfx-yaml/issues/344
257+
# and https://github.com/googleapis/sphinx-docfx-yaml/issues/345.
258+
"sphinxcontrib-applehelp==1.0.4",
259+
"sphinxcontrib-devhelp==1.0.2",
260+
"sphinxcontrib-htmlhelp==2.0.1",
261+
"sphinxcontrib-qthelp==1.0.3",
262+
"sphinxcontrib-serializinghtml==1.1.5",
263+
"gcp-sphinx-docfx-yaml",
264+
"alabaster",
265+
"recommonmark",
266+
"sphinx_rtd_theme",
267+
)
268+
269+
shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True)
270+
session.run(
271+
"sphinx-build",
272+
"-T", # show full traceback on exception
273+
"-N", # no colors
274+
"-D",
275+
(
276+
"extensions=sphinx.ext.autodoc,"
277+
"sphinx.ext.autosummary,"
278+
"docfx_yaml.extension,"
279+
"sphinx.ext.intersphinx,"
280+
"sphinx.ext.coverage,"
281+
"sphinx.ext.napoleon,"
282+
"sphinx.ext.todo,"
283+
"sphinx.ext.viewcode,"
284+
"recommonmark"
285+
),
286+
"-b",
287+
"html",
288+
"-d",
289+
os.path.join("docs", "_build", "doctrees", ""),
290+
os.path.join("docs", ""),
291+
os.path.join("docs", "_build", "html", ""),
292+
)
293+
294+
246295
@nox.session(python=DEFAULT_PYTHON_VERSION)
247296
def lint_setup_py(session):
248297
"""Verify that setup.py is valid (including RST check)."""

0 commit comments

Comments
 (0)