diff options
author | Anthony Sottile <asottile@umich.edu> | 2018-06-03 00:57:02 -0700 |
---|---|---|
committer | Gábor Bernát <gaborjbernat@gmail.com> | 2018-06-03 08:57:02 +0100 |
commit | f63b3549b024f79bb07bcfd436dc9c65870583a3 (patch) | |
tree | 781811013341df6a5e94de2b942630efdf94130a /doc | |
parent | 607ec951f723800f2207b670dfb4d1270ea83201 (diff) | |
download | tox-git-f63b3549b024f79bb07bcfd436dc9c65870583a3.tar.gz |
blacken-docs (#835)
Hi friends, I made a terrific (terrible? terrifying?) thing.
I needed one manual `,` addition to the `setup.py` example so it could be parsed -- otherwise this is fully automated!
Using the new thing I made today: https://github.com/asottile/blacken-docs
Heavily inspired by pytest-dev/pytest#3525. See also ambv/black#292, ambv/black#294.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/example/jenkins.rst | 23 | ||||
-rw-r--r-- | doc/plugins.rst | 12 |
2 files changed, 22 insertions, 13 deletions
diff --git a/doc/example/jenkins.rst b/doc/example/jenkins.rst index 1d658ee1..12b08fc3 100644 --- a/doc/example/jenkins.rst +++ b/doc/example/jenkins.rst @@ -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 @@ -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: @@ -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. diff --git a/doc/plugins.rst b/doc/plugins.rst index a870f1ce..db65766d 100644 --- a/doc/plugins.rst +++ b/doc/plugins.rst @@ -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.""" @@ -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 |