diff options
author | Bruno Oliveira <nicoddemus@gmail.com> | 2019-01-09 22:42:18 -0200 |
---|---|---|
committer | Bruno Oliveira <nicoddemus@gmail.com> | 2019-01-09 22:45:09 -0200 |
commit | 9f6d9efc1d504009966430b86b73c7cb089f5bea (patch) | |
tree | 57dfa829c06a820b2e37f1864c21a477e7412174 /doc/en/goodpractices.rst | |
parent | a0ab5a7cd84941f0bd27793b2407d4e673d6882a (diff) | |
download | pytest-9f6d9efc1d504009966430b86b73c7cb089f5bea.tar.gz |
Mention PYTHONPATH semantics in goodpractices.rst
Fix #4625
Diffstat (limited to 'doc/en/goodpractices.rst')
-rw-r--r-- | doc/en/goodpractices.rst | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/doc/en/goodpractices.rst b/doc/en/goodpractices.rst index 70c369244..080685a4c 100644 --- a/doc/en/goodpractices.rst +++ b/doc/en/goodpractices.rst @@ -72,8 +72,18 @@ to keep tests separate from actual application code (often a good idea):: test_view.py ... -This way your tests can run easily against an installed version -of ``mypkg``. +This has the following benefits: + +* Your tests can run against an installed version after executing ``pip install .``. +* Your tests can run against the local copy with an editable install after executing ``pip install --editable .``. +* If you don't have a ``setup.py`` file and are relying on the fact that Python by default puts the current + directory in ``sys.path`` to import your package, you can execute ``python -m pytest`` to execute the tests against the + local copy directly, without using ``pip``. + +.. note:: + + See :ref:`pythonpath` for more information about the difference between calling ``pytest`` and + ``python -m pytest``. Note that using this scheme your test files must have **unique names**, because ``pytest`` will import them as *top-level* modules since there are no packages |