Skip to content

Move documentation to read the docs #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ on:
- cron: 1 0 * * * # Run daily at 0:01 UTC

jobs:
build_docs:
name: Build Docs
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install tox
run: |
python -m pip install --upgrade tox
- name: Build docs with tox
run: |
python -m tox -e docs
build_python:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ Pipfile.lock

# tox folders
.tox

# sphinx/read the docs
docs/_build/
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
56 changes: 56 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------

project = "pytest-html"
copyright = "2020, Dave Hunt" # noqa: A001
author = "Dave Hunt"


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "alabaster"
html_theme_options = {
"github_user": "pytest-dev",
"github_repo": "pytest-html",
"github_banner": "true",
"github_type": "star",
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]

# The master toctree document.
master_doc = "index"
126 changes: 126 additions & 0 deletions docs/development.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
Development
===========

To contribute to `pytest-html` you can use `Pipenv`_ to manage a python virtual environment and
`pre-commit`_ to help you with styling and formatting.

To setup the virtual environment and pre-commit, run:

.. code-block:: bash

$ pipenv install --dev
$ pipenv run pre-commit install

If you're not using `Pipenv`_, run the following to install `pre-commit`_:

.. code-block:: bash

$ pip install pre-commit
$ pre-commit install


Automated Testing
-----------------

All pull requests and merges are tested in `GitHub Actions`_ which are defined inside ``.github`` folder.

To retrigger CI to run again for a pull request, you either use dropdown option, close and reopen pull-request
or to just update the branch containing it.

You can do this with `git commit --allow-empty`

Running Tests
-------------

Python
~~~~~~

You will need `Tox`_ installed to run the tests against the supported Python versions. If you're using `Pipenv`_
it will be installed for you.

With `Pipenv`_, run:

.. code-block:: bash

$ pipenv run tox

Otherwise, to install and run, do:

.. code-block:: bash

$ pip install tox
$ tox

JavaScript
~~~~~~~~~~

You will need `npm`_ installed to run the JavaScript tests. Internally, we use `Grunt`_ and `QUnit`_ to run the tests.

Once `npm`_ is installed, you can install all needed dependencies by running:

.. code-block:: bash

$ npm install

Run the following to execute the tests:

.. code-block:: bash

$ npm test

Documentation
-------------

Documentation is hosted on `Read the Docs`_, and is written in `RST`_. Remember to add any new files to the :code:`toctree`
section in :code:`index.rst`.

To build your documentation, run:

.. code-block:: bash

$ tox -e docs

You can then run a local webserver to verify your changes compiled correctly.

SASS/SCSS/CSS
-------------

You will need `npm`_ installed to compile the CSS, which is generated via `SASS/SCSS`_.

Once `npm`_ is installed, you can install all needed dependencies by running:

.. code-block:: bash

$ npm install

Run the following to generate the CSS:

.. code-block:: bash

$ npm run build:css

Releasing a new version
-----------------------

Follow these steps to release a new version of the project:

#. Update your local master with the upstream master (``git pull --rebase upstream master``)
#. Create a new branch
#. Update ``CHANGES.rst`` with the new version, today's date, and all changes/new features
#. Commit and push the new branch and then create a new pull request
#. Wait for tests and reviews and then merge the branch
#. Once merged, update your local master again (``git pull --rebase upstream master``)
#. Tag the release with the new release version (``git tag v<new tag>``)
#. Push the tag (``git push upstream --tags``)
#. Done. Check `Github Actions`_ for release progress.

.. _GitHub Actions: https://github.com/pytest-dev/pytest-html/actions
.. _Grunt: https://gruntjs.com
.. _npm: https://www.npmjs.com
.. _Pipenv: https://pipenv.pypa.io/en/latest
.. _pre-commit: https://pre-commit.com
.. _QUnit: https://qunitjs.com
.. _Read The Docs: https://readthedocs.com
.. _RST: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html
.. _SASS/SCSS: https://sass-lang.com
.. _Tox: https://tox.readthedocs.io
19 changes: 19 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.. pytest-html documentation master file, created by
sphinx-quickstart on Sun Dec 6 20:48:43 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

pytest-html
===========

pytest-html is a plugin for `pytest`_ that generates a HTML report for test results.

.. toctree::
:maxdepth: 2
:caption: Contents:

installing
user_guide
development

.. _pytest: http://pytest.org
24 changes: 24 additions & 0 deletions docs/installing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Installation
============

Requirements
------------

pytest-html will work with Python >=3.6 or PyPy3.

Installing pytest-html
----------------------

To install pytest-html using `pip`_:

.. code-block:: bash

$ pip install pytest-html

To install from source:

.. code-block:: bash

$ pip install -e .

.. _pip: https://pip.pypa.io/
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
Loading