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

Uli Fouquet uli at gnufix.de
Mon May 4 07:13:34 EDT 2009


Log message for revision 99705:
  Update tests.

Changed:
  U   z3c.testsetup/trunk/src/z3c/testsetup/basicsetup.txt
  U   z3c.testsetup/trunk/src/z3c/testsetup/tests/README_OLD.txt

-=-
Modified: z3c.testsetup/trunk/src/z3c/testsetup/basicsetup.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/basicsetup.txt	2009-05-04 11:12:59 UTC (rev 99704)
+++ z3c.testsetup/trunk/src/z3c/testsetup/basicsetup.txt	2009-05-04 11:13:33 UTC (rev 99705)
@@ -70,7 +70,7 @@
 ----------------------
 
 By default, all .txt and .rst files are taken
-into account::
+into account, that do not start with a dot::
 
    >>> exts = ['.rst', '.txt']
    >>> [x for x in file_list if not os.path.splitext(x)[1].lower() in exts]
@@ -87,8 +87,8 @@
    >>> file_list
    [...'...subdirfile.txt'...]
 
-Hidden directories, however, are skipped. To check this, we look for a
-'hidden' testfile put into a hidden directory in the `cave`
+Hidden directories and files, however, are skipped. To check this, we
+look for a 'hidden' testfile put into a hidden directory in the `cave`
 directory. We first make sure, that the hidden file really exists::
 
    >>> cavepath = os.path.dirname(cave.__file__)
@@ -101,6 +101,16 @@
    >>> hiddenpath in file_list
    False
 
+Also another hidden file, which resides in a regular (non-hidden)
+directory was skipped:
+
+   >>> hiddenfile = os.path.join(cavepath, '.hiddenfile.txt')
+   >>> os.path.exists(hiddenfile)
+   True
+
+   >>> hiddenpath in file_list
+   False
+
 To provide a more finegrained filtering, ``BasicTestSetup`` provides a
 method ``isTestFile(filepath)``, which returns ``True`` for accepted
 files and ``False`` otherwise. This method is called for every file
@@ -126,7 +136,11 @@
    >>> basic_setup.isTestFile('cave.foo')
    False
 
+Hidden files (i.e. such starting with a dot in filename) are ignored:
 
+   >>> basic_setup.isTestFile('.hiddenfile.txt')
+   False
+
 How to find a customized set of files:
 --------------------------------------
 
@@ -146,10 +160,11 @@
 ``filter_func`` to the ``BasicTestSetup`` constructor::
 
    >>> def myFilter(filename):
+   ...     # We accept all '.txt' files, also hidden ones.
    ...     return filename.endswith('.txt')
    >>> basic_setup2 = BasicTestSetup(cave, filter_func=myFilter)
    >>> len(basic_setup2.getDocTestFiles())
-   2
+   3
 
 Note, that the filter function must accept a single parameter, which
 should contain a filepath as string and it should return a boolean
@@ -161,7 +176,7 @@
 
    >>> basic_setup3 = BasicTestSetup(cave, extensions=['.txt'])
 
-Note, that the extensions should alway be written with a leading dot
+Note, that the extensions should always be written with a leading dot
 and in lower case. Such we can find only .txt files::
 
    >>> len(basic_setup3.getDocTestFiles())

Modified: z3c.testsetup/trunk/src/z3c/testsetup/tests/README_OLD.txt
===================================================================
--- z3c.testsetup/trunk/src/z3c/testsetup/tests/README_OLD.txt	2009-05-04 11:12:59 UTC (rev 99704)
+++ z3c.testsetup/trunk/src/z3c/testsetup/tests/README_OLD.txt	2009-05-04 11:13:33 UTC (rev 99705)
@@ -121,7 +121,9 @@
    found. Now, we define a plain filter function::
 
       >>> def custom_file_filter(path):
-      ...     """Accept all txt files."""
+      ...     """Accept all txt files that are not hidden."""
+      ...     if os.path.basename(path).startswith('.'):
+      ...       return False
       ...     return path.endswith('.txt')
 
    This one accepts all '.txt' files. We run `register_all_tests`



More information about the Checkins mailing list