Skip to content
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

blacken-docs #835

Merged
merged 1 commit into from
Jun 3, 2018
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
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ repos:
- repo: https://github.com/ambv/black
rev: 18.5b1
hooks:
- id: black
args: [--line-length=99, --safe]
python_version: python3.6
- id: black
args: [--line-length=99, --safe]
language_version: python3.6
- repo: https://github.com/asottile/blacken-docs
rev: v0.1.0
hooks:
- id: blacken-docs
additional_dependencies: [black==18.5b1]
language_version: python3.6
- repo: https://github.com/asottile/seed-isort-config
rev: v0.1.0
hooks:
Expand Down
23 changes: 13 additions & 10 deletions doc/example/jenkins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ using these steps:

import tox

os.chdir(os.getenv('WORKSPACE'))
tox.cmdline() # environment is selected by ``TOXENV`` env variable
os.chdir(os.getenv("WORKSPACE"))
tox.cmdline() # environment is selected by ``TOXENV`` env variable

* check ``Publish JUnit test result report`` and enter
``**/junit-*.xml`` as the pattern so that Jenkins collects
Expand Down Expand Up @@ -58,11 +58,12 @@ with this:
.. code-block:: python

import urllib, os

url = "https://bitbucket.org/hpk42/tox/raw/default/toxbootstrap.py"
#os.environ['USETOXDEV']="1" # use tox dev version
d = dict(__file__='toxbootstrap.py')
# os.environ['USETOXDEV']="1" # use tox dev version
d = dict(__file__="toxbootstrap.py")
exec urllib.urlopen(url).read() in d
d['cmdline'](['--recreate'])
d["cmdline"](["--recreate"])

The downloaded `toxbootstrap.py` file downloads all necessary files to
install ``tox`` in a virtual sub environment. Notes:
Expand Down Expand Up @@ -105,19 +106,21 @@ Here is an example:
import py
import subprocess


def test_linkcheck(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call(
["sphinx-build", "-W", "-blinkcheck",
"-d", str(doctrees), ".", str(htmldir)])
["sphinx-build", "-W", "-blinkcheck", "-d", str(doctrees), ".", str(htmldir)]
)


def test_build_docs(tmpdir):
doctrees = tmpdir.join("doctrees")
htmldir = tmpdir.join("html")
subprocess.check_call([
"sphinx-build", "-W", "-bhtml",
"-d", str(doctrees), ".", str(htmldir)])
subprocess.check_call(
["sphinx-build", "-W", "-bhtml", "-d", str(doctrees), ".", str(htmldir)]
)

3. run ``tox -e docs`` and then you may integrate this environment
along with your other environments into Jenkins.
Expand Down
12 changes: 9 additions & 3 deletions doc/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,17 @@ contents of ``tox_fireworks.py``:

hookimpl = pluggy.HookimplMarker("tox")


@hookimpl
def tox_addoption(parser):
"""Add command line option to display fireworks on request."""


@hookimpl
def tox_configure(config):
"""Post process config after parsing."""


@hookimpl
def tox_runenvreport(config):
"""Display fireworks if all was fine and requested."""
Expand All @@ -132,9 +135,12 @@ contents of ``setup.py``:

from setuptools import setup

setup(name='tox-fireworks', py_modules=['tox_fireworks'],
entry_points={'tox': ['fireworks = tox_fireworks']}
classifiers=['Framework:: tox'])
setup(
name="tox-fireworks",
py_modules=["tox_fireworks"],
entry_points={"tox": ["fireworks = tox_fireworks"]},
classifiers=["Framework:: tox"],
)

Using the **tox-** prefix in ``tox-fireworks`` is an established convention to be able to
see from the project name that this is a plugin for tox. It also makes it easier to find with
Expand Down