Improved the text a little
--HG-- branch : cx_freeze-docs
This commit is contained in:
parent
66bd4e485a
commit
899b804ec1
|
@ -681,7 +681,7 @@ and run it::
|
||||||
You'll see that the fixture finalizers could use the precise reporting
|
You'll see that the fixture finalizers could use the precise reporting
|
||||||
information.
|
information.
|
||||||
|
|
||||||
Integrate pytest runner with cx_freeze
|
Integrating pytest runner and cx_freeze
|
||||||
-----------------------------------------------------------
|
-----------------------------------------------------------
|
||||||
|
|
||||||
If you freeze your application using a tool like
|
If you freeze your application using a tool like
|
||||||
|
@ -689,18 +689,18 @@ If you freeze your application using a tool like
|
||||||
to your end-users, it is a good idea to also package your test runner and run
|
to your end-users, it is a good idea to also package your test runner and run
|
||||||
your tests using the frozen application.
|
your tests using the frozen application.
|
||||||
|
|
||||||
This way you can detect packaging errors such as dependencies not being
|
This way packaging errors such as dependencies not being
|
||||||
included into the executable while also allowing you to send test files to
|
included into the executable can be detected early while also allowing you to
|
||||||
users so they can run them in their machines, which can be invaluable to
|
send test files to users so they can run them in their machines, which can be
|
||||||
obtain more information about a hard to reproduce bug.
|
invaluable to obtain more information about a hard to reproduce bug.
|
||||||
|
|
||||||
Unfortunately embedding the ``pytest`` runner into a frozen executable using
|
Unfortunately embedding the ``pytest`` runner into a frozen executable using
|
||||||
``cx_freeze`` is not as straightforward as one would like,
|
``cx_freeze`` is not as straightforward as one would like,
|
||||||
because ``pytest`` makes heavy use of dynamic module loading which
|
because ``pytest`` makes heavy use of dynamic module loading which
|
||||||
``cx_freeze`` can't resolve by itself.
|
``cx_freeze`` can't resolve by itself.
|
||||||
|
|
||||||
To solve this, you have to manually include internal ``pytest`` and ``py``
|
To solve this, you have to manually include ``pytest`` and ``py``
|
||||||
modules by using the ``build_exe`` option in your ``setup.py`` script like this::
|
modules by using the ``build_exe`` option in your ``setup.py`` script, like this::
|
||||||
|
|
||||||
# contents of setup.py
|
# contents of setup.py
|
||||||
from cx_Freeze import setup, Executable
|
from cx_Freeze import setup, Executable
|
||||||
|
@ -719,8 +719,8 @@ modules by using the ``build_exe`` option in your ``setup.py`` script like this:
|
||||||
(For the complete list, check out the modules under ``_pytest`` in your
|
(For the complete list, check out the modules under ``_pytest`` in your
|
||||||
site-packages).
|
site-packages).
|
||||||
|
|
||||||
With that, you can make your program pass control over to ``pytest`` by looking
|
With that, you can make your program check for a certain flag and pass control
|
||||||
for a certain flag and handing over the other arguments::
|
over to ``pytest``::
|
||||||
|
|
||||||
# contents of app_main.py
|
# contents of app_main.py
|
||||||
import sys
|
import sys
|
||||||
|
@ -733,6 +733,7 @@ for a certain flag and handing over the other arguments::
|
||||||
# by your argument-parsing library of choice as usual
|
# by your argument-parsing library of choice as usual
|
||||||
...
|
...
|
||||||
|
|
||||||
Making it easy to execute your tests from within your frozen application::
|
This makes it convenient to execute your tests from within your frozen
|
||||||
|
application, using standard ``py.test`` command-line::
|
||||||
|
|
||||||
$ ./app_main --pytest --verbose --tb=long tests/
|
$ ./app_main --pytest --verbose --tb=long --junit-xml=results.xml test-suite/
|
Loading…
Reference in New Issue