From de31364e17a54f90099892c8fcde0d3129cbfe87 Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Thu, 27 Apr 2023 02:14:40 -0700 Subject: [PATCH] resolves #242 move the pytest hardcoded options from pyproject.toml to noxfile.py adds a tests/README.rst to document the dev workflow for unit testing. fix typo in index.rst --- docs/index.rst | 2 +- noxfile.py | 2 +- pyproject.toml | 1 - tests/README.rst | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 tests/README.rst diff --git a/docs/index.rst b/docs/index.rst index c3bf650ef..29a8be305 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,7 +15,7 @@ This theme is an adaptation of the popular `mkdocs-material This theme is regularly maintained to stay up to date with the upstream `mkdocs-material `__ repository. The HTML templates, JavaScript, and styles from the `mkdocs-material -`__ theme are incoroprated directly +`__ theme are incorporated directly with mostly minor modifications. Independent of the upstream mkdocs-material theme, this theme integrates with diff --git a/noxfile.py b/noxfile.py index 6519f508e..ed06ce884 100644 --- a/noxfile.py +++ b/noxfile.py @@ -210,7 +210,7 @@ def tests(session: nox.Session, sphinx: str): session.run("npm", "run", "build", external=True) session.install(f"sphinx{sphinx}") session.install("-r", "tests/requirements.txt") - session.run("coverage", "run", "-m", "pytest") + session.run("coverage", "run", "-m", "pytest", "-vv", "-s") # session.notify("docs") <- only calls docs(html), not dirhtml or latex builders diff --git a/pyproject.toml b/pyproject.toml index 38840c572..85a757341 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,6 @@ extend-exclude = '^/docs/tensorstore_demo/__init__\.py$' [tool.pytest.ini_options] minversion = "6.0" -addopts = "-vv -s" testpaths = ["tests"] [tool.coverage.run] diff --git a/tests/README.rst b/tests/README.rst new file mode 100644 index 000000000..3af8ed19c --- /dev/null +++ b/tests/README.rst @@ -0,0 +1,38 @@ +Unit tests +========== + +To run unit tests for the sphinx-immaterial theme, there must first be dependencies installed. +Install the dependencies by executing the following from the repo root folder: + +.. code-block:: shell + + pip install -r tests/requirements.txt + +You should now be ready to run the unit tests. This can be done directly with ``pytest`` CLI: + +.. code-block:: shell + + pytest -vv -s + +Using ``nox`` +------------- + +This repo is setup to use `nox `_ in a Continuous Integration +workflow. The above instructions can be executed with 1 ``nox`` command. + +.. code-block:: shell + + nox -s tests + +Code Coverage +------------- + +Code coverage is included when using `nox `_ as well. +The coverage report should be generated *after* running the tests with ``nox``. + +.. code-block:: shell + + nox -s coverage + +This will generate a ``.coverage_.md`` file of the coverage summary and a more in-depth analysis +in HTML form located in the ``htmlcov`` folder at the repo's root.