Skip to content

Commit

Permalink
Merge pull request #3153 from brianmaissy/document_not_to_call_main_m…
Browse files Browse the repository at this point in the history
…ultiple_times

Added note that calling pytest.main multiple times from the same process is not recommended because of import caching
  • Loading branch information
RonnyPfannschmidt committed Jan 26, 2018
2 parents ff90c9e + 4285325 commit 3bc7ced
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/3143.doc
@@ -0,0 +1 @@
Added note that calling pytest.main multiple times from the same process is not recommended because of import caching.
11 changes: 10 additions & 1 deletion doc/en/usage.rst
Expand Up @@ -387,6 +387,15 @@ hook was invoked::

$ python myinvoke.py
*** test run reporting finishing

.. note::

Calling ``pytest.main()`` will result in importing your tests and any modules
that they import. Due to the caching mechanism of python's import system,
making subsequent calls to ``pytest.main()`` from the same process will not
reflect changes to those files between the calls. For this reason, making
multiple calls to ``pytest.main()`` from the same process (in order to re-run
tests, for example) is not recommended.


.. include:: links.inc

0 comments on commit 3bc7ced

Please sign in to comment.