Merge pull request #3153 from brianmaissy/document_not_to_call_main_multiple_times

Added note that calling pytest.main multiple times from the same process is not recommended because of import caching
This commit is contained in:
Ronny Pfannschmidt 2018-01-26 11:47:16 +01:00 committed by GitHub
commit 3bc7ced97a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

1
changelog/3143.doc Normal file
View File

@ -0,0 +1 @@
Added note that calling pytest.main multiple times from the same process is not recommended because of import caching.

View File

@ -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