[Checkins] SVN: z3c.testsetup/trunk/src/z3c/testsetup/ Update tests.

Uli Fouquet uli at gnufix.de
Thu Jul 24 08:42:06 EDT 2008


Log message for revision 88787:
  Update tests.

Changed:
  U   z3c.testsetup/trunk/src/z3c/testsetup/README.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt

-=-
Modified: z3c.testsetup/trunk/src/z3c/testsetup/README.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/README.txt	2008-07-24 12:41:41 UTC (rev 88786)
+++ z3c.testsetup/trunk/src/z3c/testsetup/README.txt	2008-07-24 12:42:05 UTC (rev 88787)
@@ -191,8 +191,8 @@
 
     We define a simple custom filter::
 
-      >>> def custom_module_filter(module):
-      ...     return 'Tests with real' in str(module.__doc__)
+      >>> def custom_module_filter(module_info):
+      ...     return 'Tests with real' in open(module_info.path, 'r').read()
 
     that checks for a certain string in modules' doc strings.
 

Modified: z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt	2008-07-24 12:41:41 UTC (rev 88786)
+++ z3c.testsetup/trunk/src/z3c/testsetup/pythontestsetup.txt	2008-07-24 12:42:05 UTC (rev 88787)
@@ -185,14 +185,15 @@
 The ``isTestModule()`` method of our setup object did the filtering
 here::
 
-    >>> setup.isTestModule(module_list[0])
+    >>> from martian.scan import module_info_from_module
+    >>> setup.isTestModule(module_info_from_module(module_list[0]))
     True
 
 The module ``notatest2`` of the ``cave`` package does not contain a
 Python test marker::
 
     >>> from z3c.testsetup.tests.cave import notatest2
-    >>> setup.isTestModule(notatest2)
+    >>> setup.isTestModule(module_info_from_module(notatest2))
     False
 
 The ``regexp_list`` attribute of a ``UnitTestSetup`` contains a list
@@ -253,13 +254,16 @@
     <bound method UnitTestSetup.isTestModule of ...>
 
 As we see, the ``isTestModule`` method is used. You can pass another
-method that takes a module as only parameter and returns ``True`` or
-``False``. Let's create such a function::
+method that takes a module info as only parameter and returns ``True``
+or ``False``. A module info can be created by using
+``module_info_from_dotted_name`` and ``module_info_from_module``
+functions in the ``martian.scan`` module. Let's create such a
+function::
 
     >>> import os
-    >>> def custom_filter(module):
-    ...     modfile = os.path.basename(module.__file__)
-    ...     if modfile.startswith('notatest'):
+    >>> def custom_filter(mod_info):
+    ...     modname = mod_info.dotted_name.split('.')[-1]
+    ...     if modname.startswith('notatest'):
     ...         return True
     ...     return False
 

Modified: z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt	2008-07-24 12:41:41 UTC (rev 88786)
+++ z3c.testsetup/trunk/src/z3c/testsetup/unittestsetup.txt	2008-07-24 12:42:05 UTC (rev 88787)
@@ -169,13 +169,14 @@
 The ``isTestModule()`` method of our setup object did the filtering
 here::
 
-    >>> setup.isTestModule(testfile_list[0])
+    >>> from martian.scan import module_info_from_module
+    >>> setup.isTestModule(module_info_from_module(testfile_list[0]))
     True
 
 The `notatest2` module in `cave` does not contain a unit test marker::
 
     >>> from z3c.testsetup.tests.cave import notatest2
-    >>> setup.isTestModule(notatest2)
+    >>> setup.isTestModule(module_info_from_module(notatest2))
     False
 
 The `regexp_list` attribute of a ``UnitTestSetup`` contains a



More information about the Checkins mailing list