Skip to content

Commit 6fb46a0

Browse files
authored
Merge pull request #3104 from pbrod/patch-1
Update Freezing pytest description in simple.rst
2 parents cf9b31b + 820ea6d commit 6fb46a0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

doc/en/example/simple.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,15 +826,20 @@ Instead of freezing the pytest runner as a separate executable, you can make
826826
your frozen program work as the pytest runner by some clever
827827
argument handling during program startup. This allows you to
828828
have a single executable, which is usually more convenient.
829+
Please note that the mechanism for plugin discovery used by pytest
830+
(setupttools entry points) doesn't work with frozen executables so pytest
831+
can't find any third party plugins automatically. To include third party plugins
832+
like ``pytest-timeout`` they must be imported explicitly and passed on to pytest.main.
829833

830834
.. code-block:: python
831835
832836
# contents of app_main.py
833837
import sys
838+
import pytest_timeout # Third party plugin
834839
835840
if len(sys.argv) > 1 and sys.argv[1] == '--pytest':
836841
import pytest
837-
sys.exit(pytest.main(sys.argv[2:]))
842+
sys.exit(pytest.main(sys.argv[2:], plugins=[pytest_timeout]))
838843
else:
839844
# normal application execution: at this point argv can be parsed
840845
# by your argument-parsing library of choice as usual
@@ -845,3 +850,4 @@ This allows you to execute tests using the frozen
845850
application with standard ``pytest`` command-line options::
846851

847852
./app_main --pytest --verbose --tb=long --junitxml=results.xml test-suite/
853+

0 commit comments

Comments
 (0)