3 new commits in pytest:

https://bitbucket.org/hpk42/pytest/commits/977c9b0aadb4/
Changeset:   977c9b0aadb4
Branch:      cx_freeze-docs
User:        nicoddemus
Date:        2014-07-29 03:40:23
Summary:     Adding blurb about using pytest runner and cx_freeze
Affected #:  1 file

diff -r 853ffb854a4813a6a2f9e0ad4229dde770f6c7a8 -r 
977c9b0aadb4f869ea51f9c3d0aa0650d70ce1df doc/en/example/simple.txt
--- a/doc/en/example/simple.txt
+++ b/doc/en/example/simple.txt
@@ -681,3 +681,58 @@
 You'll see that the fixture finalizers could use the precise reporting
 information.
 
+Integrate pytest runner with cx_freeze
+-----------------------------------------------------------
+
+If you freeze your application using a tool like
+`cx_freeze <http://cx-freeze.readthedocs.org>`_ in order to distribute it
+to your end-users, it is a good idea to also package your test runner and run
+your tests using the frozen application.
+
+This way you can detect packaging errors such as dependencies not being
+included into the executable while also allowing you to send test files to
+users so they can run them in their machines, which can be invaluable to
+obtain more information about a hard to reproduce bug.
+
+Unfortunately embedding the ``pytest`` runner into a frozen executable using
+``cx_freeze`` is not as straightforward as one would like,
+because ``pytest`` makes heavy use of dynamic module loading which
+``cx_freeze`` can't resolve by itself.
+
+To solve this, you have to manually include internal ``pytest`` and ``py``
+modules by using the ``build_exe`` option in your ``setup.py`` script like 
this::
+
+    # contents of setup.py
+    from cx_Freeze import setup, Executable
+
+    includes = [
+        '_pytest.doctest',
+        '_pytest.unittest',
+        # ... lots more
+    ]
+    setup(
+        name="runtests",
+        options={"build_exe": {'includes': includes}},
+        # ... other options
+    )
+
+(For the complete list, check out the modules under ``_pytest`` in your
+site-packages).
+
+With that, you can make your program pass control over to ``pytest`` by looking
+for a certain flag and handing over the other arguments::
+
+    # contents of app_main.py
+    import sys
+
+    if len(sys.argv) > 1 and sys.argv[1] == '--pytest':
+        import pytest
+        sys.exit(pytest.main(sys.argv[2:]))
+    else:
+        # normal application execution: at this point argv can be parsed
+        # by your argument-parsing library of choice as usual
+        ...
+
+Making it easy to execute your tests from within your frozen application::
+
+    $ ./app_main --pytest --verbose --tb=long tests/
\ No newline at end of file


https://bitbucket.org/hpk42/pytest/commits/8b7156f51879/
Changeset:   8b7156f51879
Branch:      cx_freeze-docs
User:        nicoddemus
Date:        2014-07-29 03:46:57
Summary:     Improved the text a little
Affected #:  1 file

diff -r 977c9b0aadb4f869ea51f9c3d0aa0650d70ce1df -r 
8b7156f518793f69b72a5b60cb8df84df2eb75c6 doc/en/example/simple.txt
--- a/doc/en/example/simple.txt
+++ b/doc/en/example/simple.txt
@@ -681,7 +681,7 @@
 You'll see that the fixture finalizers could use the precise reporting
 information.
 
-Integrate pytest runner with cx_freeze
+Integrating pytest runner and cx_freeze
 -----------------------------------------------------------
 
 If you freeze your application using a tool like
@@ -689,18 +689,18 @@
 to your end-users, it is a good idea to also package your test runner and run
 your tests using the frozen application.
 
-This way you can detect packaging errors such as dependencies not being
-included into the executable while also allowing you to send test files to
-users so they can run them in their machines, which can be invaluable to
-obtain more information about a hard to reproduce bug.
+This way packaging errors such as dependencies not being
+included into the executable can be detected early while also allowing you to
+send test files to users so they can run them in their machines, which can be
+invaluable to obtain more information about a hard to reproduce bug.
 
 Unfortunately embedding the ``pytest`` runner into a frozen executable using
 ``cx_freeze`` is not as straightforward as one would like,
 because ``pytest`` makes heavy use of dynamic module loading which
 ``cx_freeze`` can't resolve by itself.
 
-To solve this, you have to manually include internal ``pytest`` and ``py``
-modules by using the ``build_exe`` option in your ``setup.py`` script like 
this::
+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::
 
     # contents of setup.py
     from cx_Freeze import setup, Executable
@@ -719,8 +719,8 @@
 (For the complete list, check out the modules under ``_pytest`` in your
 site-packages).
 
-With that, you can make your program pass control over to ``pytest`` by looking
-for a certain flag and handing over the other arguments::
+With that, you can make your program check for a certain flag and pass control
+over to ``pytest``::
 
     # contents of app_main.py
     import sys
@@ -733,6 +733,7 @@
         # 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/
\ No newline at end of file
+    $ ./app_main --pytest --verbose --tb=long --junit-xml=results.xml 
test-suite/
\ No newline at end of file


https://bitbucket.org/hpk42/pytest/commits/cb8998b708a6/
Changeset:   cb8998b708a6
User:        hpk42
Date:        2014-07-29 12:43:04
Summary:     Merged in nicoddemus/pytest/cx_freeze-docs (pull request #188)

Documentation example on how to integrate pytest and cx_freeze
Affected #:  1 file

diff -r 1189057a5a525222c98ceaf8d91a3e9614316409 -r 
cb8998b708a6ee9645a7dbc4255d7f6395623ff3 doc/en/example/simple.txt
--- a/doc/en/example/simple.txt
+++ b/doc/en/example/simple.txt
@@ -681,3 +681,59 @@
 You'll see that the fixture finalizers could use the precise reporting
 information.
 
+Integrating pytest runner and cx_freeze
+-----------------------------------------------------------
+
+If you freeze your application using a tool like
+`cx_freeze <http://cx-freeze.readthedocs.org>`_ in order to distribute it
+to your end-users, it is a good idea to also package your test runner and run
+your tests using the frozen application.
+
+This way packaging errors such as dependencies not being
+included into the executable can be detected early while also allowing you to
+send test files to users so they can run them in their machines, which can be
+invaluable to obtain more information about a hard to reproduce bug.
+
+Unfortunately embedding the ``pytest`` runner into a frozen executable using
+``cx_freeze`` is not as straightforward as one would like,
+because ``pytest`` makes heavy use of dynamic module loading which
+``cx_freeze`` can't resolve by itself.
+
+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::
+
+    # contents of setup.py
+    from cx_Freeze import setup, Executable
+
+    includes = [
+        '_pytest.doctest',
+        '_pytest.unittest',
+        # ... lots more
+    ]
+    setup(
+        name="runtests",
+        options={"build_exe": {'includes': includes}},
+        # ... other options
+    )
+
+(For the complete list, check out the modules under ``_pytest`` in your
+site-packages).
+
+With that, you can make your program check for a certain flag and pass control
+over to ``pytest``::
+
+    # contents of app_main.py
+    import sys
+
+    if len(sys.argv) > 1 and sys.argv[1] == '--pytest':
+        import pytest
+        sys.exit(pytest.main(sys.argv[2:]))
+    else:
+        # normal application execution: at this point argv can be parsed
+        # by your argument-parsing library of choice as usual
+        ...
+
+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 --junit-xml=results.xml 
test-suite/
\ No newline at end of file

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to