Fixed some formatting

This commit is contained in:
Bruno Oliveira 2015-12-01 22:43:11 -02:00
parent 0704fcacd7
commit d851a8fd07
1 changed files with 18 additions and 16 deletions

View File

@ -31,8 +31,8 @@ Within Python modules, ``pytest`` also discovers tests using the standard
Work with virtual environments Work with virtual environments
----------------------------------------------------------- -----------------------------------------------------------
We recommend to use virtualenv_ environments and use pip_ We recommend to use virtualenv_ environments and pip_
(or easy_install_) for installing your application and any dependencies for installing your application and any dependencies
as well as the ``pytest`` package itself. This way you will get an isolated as well as the ``pytest`` package itself. This way you will get an isolated
and reproducible environment. Given you have installed virtualenv_ and reproducible environment. Given you have installed virtualenv_
and execute it from the command line, here is an example session for unix and execute it from the command line, here is an example session for unix
@ -159,8 +159,8 @@ required configurations.
.. _`use tox`: .. _`use tox`:
Use tox and Continuous Integration servers Tox
------------------------------------------------- ---
If you frequently release code and want to make sure that your actual If you frequently release code and want to make sure that your actual
package passes all tests you may want to look into `tox`_, the package passes all tests you may want to look into `tox`_, the
@ -180,9 +180,11 @@ Integrating with setuptools / ``python setup.py test`` / ``pytest-runner``
-------------------------------------------------------------------------- --------------------------------------------------------------------------
You can integrate test runs into your setuptools based project You can integrate test runs into your setuptools based project
with pytest-runner. with the `pytest-runner <https://pypi.python.org/pypi/pytest-runner>`_ plugin.
Add this to ``setup.py`` file:: Add this to ``setup.py`` file:
.. code-block:: python
from distutils.core import setup from distutils.core import setup
# you can also import from setuptools # you can also import from setuptools
@ -194,7 +196,10 @@ Add this to ``setup.py`` file::
#..., #...,
) )
And create an alias into ``setup.cfg``file:: And create an alias into ``setup.cfg``file:
.. code-block:: ini
[aliases] [aliases]
test=pytest test=pytest
@ -210,12 +215,13 @@ arguments to py.test such as your test directory or other
options using ``--addopts``. options using ``--addopts``.
Integration with setuptools test commands Manual Integration
---------------------------------------------------- ^^^^^^^^^^^^^^^^^^
Setuptools supports writing our own Test command for invoking pytest. If for some reason you don't want/can't use ``pytest-runner``, you can write
Most often it is better to use tox_ instead, but here is how you can your own setuptools Test command for invoking pytest.
get started with setuptools integration::
.. code-block:: python
import sys import sys
@ -254,10 +260,6 @@ using the ``--pytest-args`` or ``-a`` command-line option. For example::
is equivalent to running ``py.test --durations=5``. is equivalent to running ``py.test --durations=5``.
.. seealso::
For a more powerful solution, take a look at the
`pytest-runner <https://pypi.python.org/pypi/pytest-runner>`_ plugin.
.. _standalone: .. _standalone:
.. _`genscript method`: .. _`genscript method`: