|
| 1 | +import nox |
| 2 | +from nox_poetry import session |
| 3 | + |
| 4 | +PYTHON_VERSIONS = ["3.6", "3.8", "3.9.7"] |
| 5 | +SPHINX_VERSIONS = ["3.2", "3.5.4", "4.1", "4.2"] |
| 6 | +TEST_DEPENDENCIES = [ |
| 7 | + "pytest", |
| 8 | + "pytest-xdist", |
| 9 | + "responses", |
| 10 | + "pyparsing!=3.0.4", |
| 11 | + "requests-mock", |
| 12 | +] |
| 13 | + |
| 14 | + |
| 15 | +def is_supported(python: str, sphinx: str) -> bool: |
| 16 | + return not (python == "3.6" and sphinx not in ["3.2"]) |
| 17 | + |
| 18 | + |
| 19 | +def run_tests(session, sphinx): |
| 20 | + session.install(".") |
| 21 | + session.install(*TEST_DEPENDENCIES) |
| 22 | + session.run("pip", "install", f"sphinx=={sphinx}", silent=True) |
| 23 | + session.run("pip", "install", "-r", "docs/requirements.txt", silent=True) |
| 24 | + session.run("echo", "TEST FINAL PACKAGE LIST") |
| 25 | + session.run("pip", "freeze") |
| 26 | + session.run("make", "test", external=True) |
| 27 | + |
| 28 | + |
| 29 | +@session(python=PYTHON_VERSIONS) |
| 30 | +@nox.parametrize("sphinx", SPHINX_VERSIONS) |
| 31 | +def tests(session, sphinx): |
| 32 | + if is_supported(session.python, sphinx): |
| 33 | + run_tests(session, sphinx) |
| 34 | + else: |
| 35 | + session.skip("unsupported combination") |
| 36 | + |
| 37 | + |
| 38 | +@session(python="3.9") |
| 39 | +def linkcheck(session): |
| 40 | + session.install(".") |
| 41 | + # LinkCheck cn handle rate limits since Sphinx 3.4, which is needed as |
| 42 | + # our doc has to many links to github. |
| 43 | + session.run("pip", "install", "sphinx==3.5.4", silent=True) |
| 44 | + |
| 45 | + session.run("pip", "install", "-r", "docs/requirements.txt", silent=True) |
| 46 | + session.run("make", "docs-linkcheck", external=True) |
0 commit comments