moved documentation of conftest.py hack to nose.rst

This commit is contained in:
Skylar Downes 2017-04-06 18:01:03 -07:00
parent 3aa4fb62d6
commit f7caa56a6b
3 changed files with 13 additions and 15 deletions

View File

@ -97,18 +97,7 @@ check for ini-files as follows::
.. _`how to change command line options defaults`:
.. _`adding default options`:
Change which files are added to sys.path
-----------------------------------------------
If you place a conftest.py file in the root directory of your project
(as determined by pytest, see above.) pytest will run tests against
the code below that directory by adding it to your sys.path instead of
running against your installed code.
You may find yourself wanting to do this if you ran `python setup.py install`
to set up your project, as opposed to `python setup.py develop` or any of
the package manager equivalents. Installing with develop in a
virtual environment is recommended over using the conftest.py pattern.
How to change command line options defaults
------------------------------------------------

View File

@ -104,11 +104,9 @@ sub-directory of your root::
This layout prevents a lot of common pitfalls and has many benefits, which are better explained in this excellent
`blog post by Ionel Cristian Mărieș <https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure>`_.
Tests as part of application code
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Inlining test directories into your application package
is useful if you have direct relation between tests and application modules and
want to distribute them along with your application::

View File

@ -50,6 +50,16 @@ Unsupported idioms / known issues
but there is discussion in `issue268 <https://github.com/pytest-dev/pytest/issues/268>`_ for adding some support. Note that
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading>`_.
If you place a conftest.py file in the root directory of your project
(as determined by pytest) pytest will run tests "nose style" against
the code below that directory by adding it to your sys.path instead of
running against your installed code.
You may find yourself wanting to do this if you ran `python setup.py install`
to set up your project, as opposed to `python setup.py develop` or any of
the package manager equivalents. Installing with develop in a
virtual environment like Tox is recommended over this pattern.
- nose-style doctests are not collected and executed correctly,
also doctest fixtures don't work.
@ -62,3 +72,4 @@ Unsupported idioms / known issues
being the recommended alternative.