You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
15
23
16
24
::
17
25
@@ -20,100 +28,94 @@ environments you want your project to run in into a tox.ini file residing right
20
28
envlist = py27,py36
21
29
22
30
[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
24
33
commands =
25
34
# 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
27
36
28
-
..Note ::
37
+
Note
29
38
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.
32
41
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:
34
44
35
45
::
36
46
37
47
tox
38
48
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.
80
57
81
58
.. _tox_sections:
82
59
83
60
Sections
84
61
--------
85
62
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.
88
67
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.
90
72
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}``
93
76
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.
95
80
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.
100
89
101
90
102
91
.. _tox_environments:
103
92
104
93
Modifying or Adding environments
105
94
--------------------------------
106
95
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``.
115
116
116
117
Note
117
118
118
119
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
0 commit comments