Skip to content

Commit f7caa56

Browse files
moved documentation of conftest.py hack to nose.rst
1 parent 3aa4fb6 commit f7caa56

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

doc/en/customize.rst

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Here is the algorithm which finds the rootdir from ``args``:
4949
a package and don't have any particular ini-file configuration.
5050

5151
If no ``args`` are given, pytest collects test below the current working
52-
directory and also starts determining the rootdir from there.
52+
directory and also starts determining the rootdir from there.
5353

5454
:warning: custom pytest plugin commandline arguments may include a path, as in
5555
``pytest --log-output ../../test.log args``. Then ``args`` is mandatory,
@@ -97,18 +97,7 @@ check for ini-files as follows::
9797
.. _`how to change command line options defaults`:
9898
.. _`adding default options`:
9999

100-
Change which files are added to sys.path
101-
-----------------------------------------------
102-
103-
If you place a conftest.py file in the root directory of your project
104-
(as determined by pytest, see above.) pytest will run tests against
105-
the code below that directory by adding it to your sys.path instead of
106-
running against your installed code.
107100

108-
You may find yourself wanting to do this if you ran `python setup.py install`
109-
to set up your project, as opposed to `python setup.py develop` or any of
110-
the package manager equivalents. Installing with develop in a
111-
virtual environment is recommended over using the conftest.py pattern.
112101

113102
How to change command line options defaults
114103
------------------------------------------------

doc/en/goodpractices.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ sub-directory of your root::
104104
This layout prevents a lot of common pitfalls and has many benefits, which are better explained in this excellent
105105
`blog post by Ionel Cristian Mărieș <https://blog.ionelmc.ro/2014/05/25/python-packaging/#the-structure>`_.
106106

107-
108107
Tests as part of application code
109108
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
110109

111-
112110
Inlining test directories into your application package
113111
is useful if you have direct relation between tests and application modules and
114112
want to distribute them along with your application::
@@ -189,7 +187,7 @@ You can then install your package in "editable" mode::
189187
pip install -e .
190188

191189
which lets you change your source code (both tests and application) and rerun tests at will.
192-
This is similar to running `python setup.py develop` or `conda develop` in that it installs
190+
This is similar to running `python setup.py develop` or `conda develop` in that it installs
193191
your package using a symlink to your development code.
194192

195193
Once you are done with your work and want to make sure that your actual

doc/en/nose.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ Unsupported idioms / known issues
5050
but there is discussion in `issue268 <https://github.com/pytest-dev/pytest/issues/268>`_ for adding some support. Note that
5151
`nose2 choose to avoid this sys.path/import hackery <https://nose2.readthedocs.io/en/latest/differences.html#test-discovery-and-loading>`_.
5252

53+
If you place a conftest.py file in the root directory of your project
54+
(as determined by pytest) pytest will run tests "nose style" against
55+
the code below that directory by adding it to your sys.path instead of
56+
running against your installed code.
57+
58+
You may find yourself wanting to do this if you ran `python setup.py install`
59+
to set up your project, as opposed to `python setup.py develop` or any of
60+
the package manager equivalents. Installing with develop in a
61+
virtual environment like Tox is recommended over this pattern.
62+
5363
- nose-style doctests are not collected and executed correctly,
5464
also doctest fixtures don't work.
5565

@@ -62,3 +72,4 @@ Unsupported idioms / known issues
6272
being the recommended alternative.
6373

6474

75+

0 commit comments

Comments
 (0)