Skip to content

Commit cba03b4

Browse files
authored
tox.rst: Documentation file for coala in tox
This file ensures that coala is successfully installed in tox properly. Closes coala#344
1 parent 9e1647a commit cba03b4

File tree

1 file changed

+75
-73
lines changed

1 file changed

+75
-73
lines changed

Users/tox.rst

+75-73
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
What is Tox?
2-
== == == == == == == =
3-
tox is a generic virtualenv management and test command line tool you can use for:
2+
===============
3+
4+
tox is a generic virtualenv management and test command line tool you can use
5+
for:
6+
7+
- checking your package installs correctly with different Python versions and
8+
interpreters
9+
- running your tests in each of the environments, configuring your test tool
10+
of choice
11+
- acting as a frontend to Continuous Integration servers, greatly reducing
12+
boilerplate and merging CI and shell-based testing.
413

5-
- checking your package installs correctly with different Python versions and interpreters
6-
- running your tests in each of the environments, configuring your test tool of choice
7-
- acting as a frontend to Continuous Integration servers, greatly reducing boilerplate and merging CI and shell-based testing.
814

915
taken from `tox.readthedocs.io <https://tox.readthedocs.io/en/latest/>`__.
1016

1117
Basic example.
1218
----------------------------------------------------------------
13-
First, install tox with pip install tox. Then put basic information about your project and the test
14-
environments you want your project to run in into a tox.ini file residing right next to your setup.py file:
19+
First, install tox with pip install tox. Then put basic information about
20+
your project and the test
21+
environments you want your project to run in into a tox.ini file residing
22+
right next to your setup.py file:
1523

1624
::
1725

@@ -20,100 +28,94 @@ environments you want your project to run in into a tox.ini file residing right
2028
envlist = py27,py36
2129

2230
[testenv]
23-
deps = pytest # install pytest in the virtualenv where commands will be executed
31+
deps = pytest # install pytest in the virtualenv where commands
32+
will be executed
2433
commands =
2534
# whatever extra steps before testing might be necessary
26-
pytest # or any other test runner that you might use
35+
pytest # or any other test runner that you might use
2736
28-
.. Note ::
37+
Note
2938

30-
You can also try generating a tox.ini file automatically, by running tox-quickstart
31-
and then answering a few simple questions.
39+
You can also try generating a tox.ini file automatically, by running
40+
tox-quickstart and then answering a few simple questions.
3241

33-
To sdist-package, install and test your project against Python2.7 and Python3.6, just type:
42+
To sdist-package, install and test your project against Python2.7 and
43+
Python3.6, just type:
3444

3545
::
3646

3747
tox
3848

39-
and watch things happening (you must have python2.7 and python3.6 installed in your environment
40-
otherwise you will see errors). When you run tox a second time you’ll note that it runs much faster
41-
because it keeps track of virtualenv details and will not recreate or re-install dependencies.
42-
You also might want to checkout tox configuration and usage examples to get some more ideas.
43-
44-
Environment variables
45-
---------------------
46-
47-
When running ``tox`` we've allowed for the usage of environment variables to tweak certain settings
48-
of the playbook run using Ansible's ``--extra-vars``. It's helpful in Jenkins jobs or for manual test
49-
runs of ``ceph-ansible``.
50-
51-
The following environent variables are available for use:
52-
53-
* ``FETCH_DIRECTORY`` : (default: ``changedir``) This would configure the ``ceph-ansible`` variable ``fetch_directory``. This defaults to
54-
the ``changedir`` of the given scenario and should not need to be changed.
55-
56-
* ``CEPH_STABLE_RELEASE``: (default: ``jewel``) This would configure the ``ceph-ansible`` variable ``ceph_stable_relese``. This is set
57-
automatically when using the ``jewel-*`` or ``kraken-*`` testing scenarios.
58-
59-
* ``UPDATE_CEPH_STABLE_RELEASE``: (default: ``kraken``) This would configure the ``ceph-ansible`` variable ``ceph_stable_relese`` during an ``update``
60-
scenario. This is set automatically when using the ``jewel-*`` or ``kraken-*`` testing scenarios.
61-
62-
* ``CEPH_DOCKER_REGISTRY``: (default: ``docker.io``) This would configure the ``ceph-ansible`` variable ``ceph_docker_registry``.
63-
64-
* ``CEPH_DOCKER_IMAGE``: (default: ``ceph/daemon``) This would configure the ``ceph-ansible`` variable ``ceph_docker_image``.
65-
66-
* ``CEPH_DOCKER_IMAGE_TAG``: (default: ``latest``) This would configure the ``ceph-ansible`` variable ``ceph_docker_image_name``.
67-
68-
* ``CEPH_DEV_BRANCH``: (default: ``master``) This would configure the ``ceph-ansible`` variable ``ceph_dev_branch`` which defines which branch we'd
69-
like to install from shaman.ceph.com.
70-
71-
* ``CEPH_DEV_SHA1``: (default: ``latest``) This would configure the ``ceph-ansible`` variable ``ceph_dev_sha1`` which defines which sha1 we'd like
72-
to install from shaman.ceph.com.
73-
74-
* ``UPDATE_CEPH_DEV_BRANCH``: (default: ``master``) This would configure the ``ceph-ansible`` variable ``ceph_dev_branch`` which defines which branch we'd
75-
like to update to from shaman.ceph.com.
76-
77-
* ``UPDATE_CEPH_DEV_SHA1``: (default: ``latest``) This would configure the ``ceph-ansible`` variable ``ceph_dev_sha1`` which defines which sha1 we'd like
78-
to update to from shaman.ceph.com.
79-
49+
and watch things happening (you must have python2.7 and python3.6 installed
50+
in your environment
51+
otherwise you will see errors). When you run tox a second time you’ll note
52+
that it runs much faster
53+
because it keeps track of virtualenv details and will not recreate or
54+
re-install dependencies.
55+
You also might want to checkout tox configuration and usage examples to get
56+
some more ideas.
8057

8158
.. _tox_sections:
8259

8360
Sections
8461
--------
8562

86-
The ``tox.ini`` file has a number of top level sections defined by ``[ ]`` and subsections within those. For complete documentation
87-
on all subsections inside of a tox section please refer to the tox documentation.
63+
The ``tox.ini`` file has a number of top level sections defined by ``[ ]``
64+
and subsections within those. For complete documentation
65+
on all subsections inside of a tox section please refer to the tox
66+
documentation.
8867

89-
* ``tox`` : This section contains the ``envlist`` which is used to create our dynamic matrix. Refer to the `section here <http://tox.readthedocs.io/en/latest/config.html#generating-environments-conditional-settings>`_ for more information on how the ``envlist`` works.
68+
- ``tox`` : This section contains the ``envlist`` which is used to create
69+
our dynamic matrix. Refer to the `section here <http://tox.readthedocs.io/
70+
en/latest/config.html#generating-environments-conditional-settings>`_ for
71+
more information on how the ``envlist`` works.
9072

91-
* ``purge`` : This section contains commands that only run for scenarios that purge the cluster and redeploy. You'll see this section being reused in ``testenv``
92-
with the following syntax: ``{[purge]commands}``
73+
- ``purge`` : This section contains commands that only run for scenarios
74+
that purge the cluster and redeploy. You'll see this section being reused in
75+
``testenv``with the following syntax: ``{[purge]commands}``
9376

94-
* ``update`` : This section contains commands taht only run for scenarios that deploy a cluster and then upgrade it to another Ceph version.
77+
- ``update`` : This section contains commands taht only run for scenarios
78+
that
79+
deploy a cluster and then upgrade it to another Ceph version.
9580

96-
* ``testenv`` : This is the main section of the ``tox.ini`` file and is run on every scenario. This section contains many *factors* that define conditional
97-
settings depending on the scenarios defined in the ``envlist``. For example, the factor ``centos7_cluster`` in the ``changedir`` subsection of ``testenv`` sets
98-
the directory that tox will change do when that factor is selected. This is an important behavior that allows us to use the same ``tox.ini`` and reuse commands while
99-
tweaking certain sections per testing scenario.
81+
- ``testenv`` : This is the main section of the ``tox.ini`` file and is run
82+
on every scenario. This section contains many *factors* that define
83+
conditional settings depending on the scenarios defined in the ``envlist``.
84+
For example, the factor``centos7_cluster`` in the ``changedir`` subsection
85+
of ``testenv`` sets the directory that tox will change do when that factor
86+
is selected. This is an important behavior that allows us to use the same
87+
``tox.ini`` and reuse commands while tweaking certain sections per testing
88+
scenario.
10089

10190

10291
.. _tox_environments:
10392

10493
Modifying or Adding environments
10594
--------------------------------
10695

107-
The tox environments are controlled by the ``envlist`` subsection of the ``[tox]`` section. Anything inside of ``{}`` is considered a *factor* and will be included
108-
in the dynamic matrix that tox creates. Inside of ``{}`` you can include a comma separated list of the *factors*. Do not use a hyphen (``-``) as part
109-
of the *factor* name as those are used by tox as the separator between different factor sets.
110-
111-
For example, if wanted to add a new test *factor* for the next Ceph release of luminious this is how you'd accomplish that. Currently, the first factor set in our ``envlist``
112-
is used to define the Ceph release (``{jewel,kraken,rhcs}-...``). To add luminous you'd change that to look like ``{luminous,kraken,rhcs}-...``. In the ``testenv`` section
113-
this is a subsection called ``setenv`` which allows you to provide environment variables to the tox environment and we support an environment variable called ``CEPH_STABLE_RELEASE``.
114-
To ensure that all the new tests that are created by adding the luminous *factor* you'd do this in that section: ``luminous: CEPH_STABLE_RELEASE=luminous``.
96+
The tox environments are controlled by the ``envlist`` subsection of the
97+
``[tox]`` section. Anything inside of ``{}`` is considered a *factor* and
98+
will be included
99+
in the dynamic matrix that tox creates. Inside of ``{}`` you can include
100+
a comma separated list of the *factors*. Do not use a hyphen (``-``) as part
101+
of the *factor* name as those are used by tox as the separator between
102+
different factor sets.
103+
104+
For example, if wanted to add a new test *factor* for the next Ceph
105+
release of luminious this is how you'd accomplish that. Currently, the first
106+
factor set in our ``envlist``
107+
is used to define the Ceph release (``{jewel,kraken,rhcs}-...``). To add
108+
luminous you'd change that to look like ``{luminous,kraken,rhcs}-...``.
109+
In the ``testenv`` section
110+
this is a subsection called ``setenv`` which allows you to provide environment
111+
variables to the tox environment and we support an environment variable
112+
called ``CEPH_STABLE_RELEASE``.
113+
To ensure that all the new tests that are created by adding the luminous
114+
*factor* you'd do this in that section:
115+
``luminous: CEPH_STABLE_RELEASE=luminous``.
115116

116117
Note
117118

118119

119-
For more information about Tox configuration, consult the `official documentation <https://tox.readthedocs.io/en/latest/>`__.
120+
For more information about Tox configuration, consult the
121+
`official documentation <https://tox.readthedocs.io/en/latest/>`__.

0 commit comments

Comments
 (0)