[Checkins] SVN: zope.pytest/trunk/doc/samples.rst Add doctests/samples for browser-based tests.
Uli Fouquet
uli at gnufix.de
Sun Jan 23 22:33:47 EST 2011
Log message for revision 119858:
Add doctests/samples for browser-based tests.
Changed:
U zope.pytest/trunk/doc/samples.rst
-=-
Modified: zope.pytest/trunk/doc/samples.rst
===================================================================
--- zope.pytest/trunk/doc/samples.rst 2011-01-24 03:32:43 UTC (rev 119857)
+++ zope.pytest/trunk/doc/samples.rst 2011-01-24 03:33:47 UTC (rev 119858)
@@ -241,8 +241,36 @@
The most interesting point about functional testing might be to check
Zope-generated output, i.e. browser pages or similar.
-This task needs much more setup where `zope.pytest` can come to help.
+This task normally needs much more setup where `zope.pytest` can come
+to help to minimize the efforts dramatically.
+.. doctest::
+ :hide:
+
+ >>> mypkg_dir = register_fixture('browser')
+
+When run, all tests pass:
+
+ >>> import pytest
+ >>> pytest.main(mypkg_dir)
+ =============...=== test session starts ====...================
+ platform ... -- Python 2... -- pytest-...
+ collecting ...
+ collected 7 items
+ <BLANKLINE>
+ .../mypkg/tests/test_app.py ...
+ .../mypkg/tests/test_browser.py ..
+ .../mypkg/tests/test_foo.py ..
+ <BLANKLINE>
+ =============...=== 7 passed in ... seconds ===...=============
+ 0
+
+.. doctest::
+ :hide:
+
+ >>> unregister_fixture(mypkg_dir)
+
+
.. _ZCML: http://docs.zope.org/zopetoolkit/codingstyle/zcml-style.html
.. _pytest: http://pytest.org/
.. _py.test: http://pytest.org/
More information about the checkins
mailing list