ztfy/utils/tests/test_utilsdocstrings.py
branchZTK-1.1
changeset 149 738abc5935c9
parent 148 d3668ecd9137
child 150 3b6ce9aacac2
--- a/ztfy/utils/tests/test_utilsdocstrings.py	Wed Jun 20 16:29:53 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-### -*- coding: utf-8 -*- ####################################################
-##############################################################################
-#
-# Copyright (c) 2008-2010 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-"""
-Generic Test case for ztfy.utils doc strings
-"""
-__docformat__ = 'restructuredtext'
-
-import unittest
-import doctest
-import sys
-import os
-
-
-current_dir = os.path.abspath(os.path.dirname(__file__))
-
-def doc_suite(test_dir, globs=None):
-    """Returns a test suite, based on doc tests strings found in /*.py"""
-    suite = []
-    if globs is None:
-        globs = globals()
-
-    flags = (doctest.ELLIPSIS | doctest.NORMALIZE_WHITESPACE |
-             doctest.REPORT_ONLY_FIRST_FAILURE)
-
-    package_dir = os.path.split(test_dir)[0]
-    if package_dir not in sys.path:
-        sys.path.append(package_dir)
-
-    # filtering files on extension
-    docs = [doc for doc in
-            os.listdir(package_dir) if doc.endswith('.py')]
-    docs = [doc for doc in docs if not doc.startswith('__')]
-
-    for test in docs:
-        fd = open(os.path.join(package_dir, test))
-        content = fd.read()
-        fd.close()
-        if '>>> ' not in content:
-            continue
-        test = test.replace('.py', '')
-        location = 'ztfy.utils.%s' % test
-        suite.append(doctest.DocTestSuite(location, optionflags=flags,
-                                          globs=globs))
-
-    return unittest.TestSuite(suite)
-
-def test_suite():
-    """returns the test suite"""
-    return doc_suite(current_dir)
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')
-