File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -826,15 +826,20 @@ Instead of freezing the pytest runner as a separate executable, you can make
826
826
your frozen program work as the pytest runner by some clever
827
827
argument handling during program startup. This allows you to
828
828
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.
829
833
830
834
.. code-block :: python
831
835
832
836
# contents of app_main.py
833
837
import sys
838
+ import pytest_timeout # Third party plugin
834
839
835
840
if len (sys.argv) > 1 and sys.argv[1 ] == ' --pytest' :
836
841
import pytest
837
- sys.exit(pytest.main(sys.argv[2 :]))
842
+ sys.exit(pytest.main(sys.argv[2 :], plugins = [pytest_timeout] ))
838
843
else :
839
844
# normal application execution: at this point argv can be parsed
840
845
# by your argument-parsing library of choice as usual
@@ -845,3 +850,4 @@ This allows you to execute tests using the frozen
845
850
application with standard ``pytest `` command-line options::
846
851
847
852
./app_main --pytest --verbose --tb=long --junitxml=results.xml test-suite/
853
+
You can’t perform that action at this time.
0 commit comments