[Checkins] SVN: zope.pytest/trunk/doc/grok_samples.rst Minor fixes: typos, markup.

Uli Fouquet uli at gnufix.de
Thu Jan 20 07:47:58 EST 2011


Log message for revision 119771:
  Minor fixes: typos, markup.
  

Changed:
  U   zope.pytest/trunk/doc/grok_samples.rst

-=-
Modified: zope.pytest/trunk/doc/grok_samples.rst
===================================================================
--- zope.pytest/trunk/doc/grok_samples.rst	2011-01-20 12:40:15 UTC (rev 119770)
+++ zope.pytest/trunk/doc/grok_samples.rst	2011-01-20 12:47:57 UTC (rev 119771)
@@ -1,22 +1,22 @@
 py.test examples for Grok
 =========================
 
-In typical Zpe/Grok development we know three kind of tests:
+In typical Zope/Grok development we have three kinds of tests:
 
   - unit-tests
   - integration-tests
   - funktional-tests
 
-With the help of py.test we can create and run all of these tests in 
-an easy way for Grok. In this tutorial we will demonstrate the
-usage of zope.pytest with this three kind of tests.
+With the help of py.test we can create and run all of these tests in
+an easy way for Grok. In this tutorial we will demonstrate the usage
+of zope.pytest with this three kinds of tests.
 
 
 Buildout
 --------
 
-Let's start with extending the default generated buildout.cfg by 
-grokproject to use zope.pytest.
+Let's start by extending the default ``buildout.cfg`` generated by
+`grokproject` to use zope.pytest.
 
 To find all relevant packages of pytest we have to add 
 
@@ -24,7 +24,7 @@
 
 to the find_links.
 
-Then we can add a new part called 'pytest'. Don't forget to add it 
+Then we can add a new section called ``pytest``. Don't forget to add it 
 to the global parts too!
 
 Here is the pytest section::
@@ -36,19 +36,20 @@
       pytest
     arguments = ['src/example'] + sys.argv[1:]
 
-Please notice the 'example' is the name of the package which is
-generated by grokproject.
+Please notice that ``example`` is the name of the package generated by
+`grokproject`.
 
-After running bin/buildout we should have a new executable called
-bin/py.test which search for tests in the directory src/example.
+After running ``bin/buildout`` we should have a new executable called
+``bin/py.test`` which can search for tests in the directory
+``src/example``.
 
 
-unit-tests
+Unit Tests
 ----------
 
-To run unit-tests with pytest we have to create a file with the
-prefix ``test_``. Ok so let's create a file test_unit.py with the
-following content.
+To run unit tests with `pytest` we have to create a file with the
+prefix ``test_``. So, let's create a file ``test_unit.py`` with the
+following content:
 
 .. code-block:: python
 
@@ -63,8 +64,8 @@
             assert x == "hello"
 
 
-Now we can run this test with bin/py.test we should get one failing
-test::
+Now we can run this test with ``bin/py.test``. We should get one
+failing test::
 
 
     ==================================== FAILURES =====================================
@@ -83,14 +84,16 @@
     ======================= 1 failed, 3 passed in 1.14 seconds ========================
 
 
-integration-tests
+Integration Tests
 -----------------
 
-For integration tests we need a bit more setup. To be more precise we have to
-load the Zope Component Architecture.
+For integration tests we need a bit more setup. To be more precise we
+have to load the Zope Component Architecture before respective tests
+are actually run.
 
-To run the integration test we need a bit of code that registers something in
-the Zope Component Architecture. Take a look on this example in app.py:
+To run the integration test we need a bit of code that registers
+something in the Zope Component Architecture. Take a look at this
+example in ``app.py``:
 
 .. code-block:: python 
 
@@ -104,10 +107,12 @@
         def render(self):
             return "Hello World"
 
-Ok now we have some code to test. 
-We have to create again a module with holds our test prefixed with ``test_``.
-So we call it test_integration.py
+Now we have some code to test.
 
+We have to create another module which contains our test and whose
+name is prefixed with ``test_``.  This time we name it
+``test_integration.py``:
+
 .. code-block:: python
 
     import example 
@@ -132,26 +137,25 @@
             (Example(), zope_req), name=u"index")
         assert "Hello World" in view()
 
-The intresting bits are the two pytest_funcarg functions: 
+The interesting bits are the two ``pytest_funcarg__`` functions: 
 
-  - pytest_funcarg__app 
-    This function creates a test ZODB with our Example
-    Application in the site-root.
+  - ``pytest_funcarg__app``
+        This function creates a test ZODB with our `Example`
+        application in the ZODB root.
 
-  - pytest_funcarg__config
-    This function sets up the Zope Component Registry
-    which groks in this case the contents of our app.py
+  - ``pytest_funcarg__config``
+        This function sets up the Zope Component Registry which groks
+        in this case the contents of our app.py.
 
+Now you can run ``bin/py.test`` again and will see that pytest will
+discover and execute this ``test_integration`` module.
 
-You can now again run bin/py.test you will see that pytest
-will discover and execute this test_integration module.
 
-
-functional-tests
+Functional Tests
 ----------------
 
 We take again the example in the app.py file for demonstrating
-the functional tests with zope.pytest in grok. Functional Tests
+the functional tests with zope.pytest in grok. Functional tests
 showing the perspective of a user. This means we test here
 with a kind of a browser. We take for this infrae.testbrowser.
 



More information about the checkins mailing list