[pypy-svn] r55033 - pypy/django/tests

hpk at codespeak.net hpk at codespeak.net
Tue May 20 18:30:15 CEST 2008


Author: hpk
Date: Tue May 20 18:30:14 2008
New Revision: 55033

Modified:
   pypy/django/tests/conftest.py
Log:
(anto, hpk) try to find all of the doctests which works but some of them fail 
with obscure unicode stuff 


Modified: pypy/django/tests/conftest.py
==============================================================================
--- pypy/django/tests/conftest.py	(original)
+++ pypy/django/tests/conftest.py	Tue May 20 18:30:14 2008
@@ -93,8 +93,8 @@
         return result
 
     def _find_doctests(self, mod):
-        if hasattr(mod, '__test__') and mod.__test__.get('API_TESTS'):
-            return ['%docstring%']
+        if hasattr(mod, '__test__'):
+            return ["__test__[%s]" % x for x in mod.__test__.keys()]
         if os.path.basename(mod.__file__).startswith("tests") and mod.__doc__:
             return ['%docmodulestring%']
             #return [)]
@@ -119,11 +119,13 @@
         if name == '%invalidtestcase%':
             return DjangoInvalidModelTestCase(name, self) 
         mod = self._get_mod()
-        if name == '%docstring%':
-            return DocTestItem(self.fspath.basename + '.%docstring%', mod, mod.__test__['API_TESTS'])
-        elif name == 'tests.%docstring%':
+        if name.startswith("__test__["):
+            doctestname = name[9:-1] 
+            return DocTestItem(name, mod, mod.__test__[doctestname])
+        elif name.startswith('tests.__test__['):
+            doctestname = name[15:-1] 
             mod = mod.tests
-            return DocTestItem(self.fspath.basename + '.%docstring%', mod, mod.__test__['API_TESTS'])
+            return DocTestItem(name, mod, mod.__test__[doctestname])
         elif name == '%docmodulestring%':
             return DocTestItem(self.fspath.basename + '.%docstring%', mod, mod.__doc__)
         elif name == 'tests.%docmodulestring%':



More information about the Pypy-commit mailing list