[pypy-svn] r54986 - in pypy/django: . tests

hpk at codespeak.net hpk at codespeak.net
Tue May 20 11:40:31 CEST 2008


Author: hpk
Date: Tue May 20 11:40:29 2008
New Revision: 54986

Modified:
   pypy/django/   (props changed)
   pypy/django/tests/conftest.py
Log:
(anto, hpk) 
add pysqlite3 as an external for now
automatically add django to python module lookup path 
rename classes 
    


Modified: pypy/django/tests/conftest.py
==============================================================================
--- pypy/django/tests/conftest.py	(original)
+++ pypy/django/tests/conftest.py	Tue May 20 11:40:29 2008
@@ -5,6 +5,9 @@
 # XXX ignores invalid models path
 
 rootdir = py.path.local(__file__).dirpath()
+pkgroot = rootdir.dirpath()
+if str(pkgroot) not in py.std.sys.path: 
+    py.std.sys.path.append(str(pkgroot))
 
 DIRNAMES = ['modeltests', 'regressiontests']#, 'django/contrib']
 
@@ -47,7 +50,7 @@
 
 loaded_apps = {}
 
-class Module(py.test.collect.Module):
+class DjangoTestModule(py.test.collect.Module):
     def run(self):
         mod = self._get_mod()
         result = self._tests_from_mod(mod)
@@ -62,15 +65,15 @@
 
     def _tests_from_mod(self, mod):
         result = []
-        if hasattr(mod, 'suite'):
-            import pdb
-            pdb.set_trace()
-        else:
-            items = [k for k, v in
-                     mod.__dict__.iteritems()
-                     if isinstance(v, type) and
-                     issubclass(v, unittest.TestCase)]
-            result += items
+        #if hasattr(mod, 'suite'):
+        #    import pdb
+        #    pdb.set_trace()
+        #else:
+        #    items = [k for k, v in
+        #             mod.__dict__.iteritems()
+        #             if isinstance(v, type) and
+        #             issubclass(v, unittest.TestCase)]
+        #    result += items
         result += self._find_doctests(mod)
         return result
 
@@ -107,7 +110,7 @@
         else:
             return getattr(mod, name)
 
-class Directory(py.test.collect.Directory):
+class DjangoTestDirectory(py.test.collect.Directory):
     def _level(self):
         rel = self.fspath.relto(rootdir)
         if not rel:
@@ -141,8 +144,8 @@
         path = self.fspath.join(name)
         if path.check(dir=1):
             if self._level() == 1:
-                return Module(self.fspath.join(name))
-            return Directory(self.fspath.join(name))
+                return DjangoTestModule(self.fspath.join(name))
+            return DjangoTestDirectory(self.fspath.join(name))
         else:
             raise NotImplementedError
 
@@ -187,3 +190,7 @@
     get_apps()
 
 setup()
+
+
+Directory = DjangoTestDirectory
+Module = DjangoTestModule



More information about the Pypy-commit mailing list