Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Commit 3ad36b9

Browse files
author
staticdev
committed
Fix noxfile
1 parent 727ece1 commit 3ad36b9

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

noxfile.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Nox sessions."""
22
import contextlib
3+
import shutil
34
import tempfile
45
from pathlib import Path
56
from typing import cast
@@ -139,8 +140,10 @@ def tests(session: Session) -> None:
139140
"""Run the test suite."""
140141
install_package(session)
141142
install(session, "coverage[toml]", "pytest", "pytest_mock")
142-
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
143-
session.notify("coverage")
143+
try:
144+
session.run("coverage", "run", "--parallel", "-m", "pytest", *session.posargs)
145+
finally:
146+
session.notify("coverage")
144147

145148

146149
@nox.session
@@ -159,3 +162,33 @@ def typeguard(session: Session) -> None:
159162
install_package(session)
160163
install(session, "pytest", "typeguard", "pytest_mock")
161164
session.run("pytest", f"--typeguard-packages={package}", *session.posargs)
165+
166+
167+
@nox.session(python=python_versions)
168+
def xdoctest(session: Session) -> None:
169+
"""Run examples with xdoctest."""
170+
args = session.posargs or ["all"]
171+
install_package(session)
172+
install(session, "xdoctest")
173+
session.run("python", "-m", "xdoctest", package, *args)
174+
175+
176+
@nox.session(python="3.8")
177+
def docs(session: Session) -> None:
178+
"""Build the documentation."""
179+
args = session.posargs or ["docs", "docs/_build"]
180+
181+
if session.interactive and not session.posargs:
182+
args.insert(0, "--open-browser")
183+
184+
builddir = Path("docs", "_build")
185+
if builddir.exists():
186+
shutil.rmtree(builddir)
187+
188+
install_package(session)
189+
install(session, "sphinx", "sphinx-autobuild")
190+
191+
if session.interactive:
192+
session.run("sphinx-autobuild", *args)
193+
else:
194+
session.run("sphinx-build", *args)

0 commit comments

Comments
 (0)