As we're so close to a release I'm going to post a patch here instead of commiting it straight away.

The patch fixes an issue with runtests.py with a lot of releases of NumPy. The latest svn version doesn't have the problem but the one shipped with the latest Ubuntu does, so I expect a lot of users may encounter it. The problem is that NumPy doesn't like distutils.unixccompiler being imported already.

One could think that the test environment should be further "sandboxed" and that all modules should be removed, but I don't know anything about sys.modules really so I'll leave that to somebody else.

Something else: The "cimport" triggers a module import so the numpy testcase fails on systems where numpy is not installed. This isn't all that serious I feel (a failing numpy testcase will communicate the right thing to users not having numpy installed) so I think we should wait until after the release (and then add some kind of "_USES" special testcase variable).

--
Dag Sverre
diff -r 72eb8b27a3d1 runtests.py
--- a/runtests.py	Mon Aug 18 07:49:35 2008 +0200
+++ b/runtests.py	Mon Aug 18 14:41:54 2008 +0200
@@ -266,7 +266,14 @@ class CythonRunTestCase(CythonCompileTes
             self.runCompileTest()
             if not self.cythononly:
                 sys.stderr.write('running doctests in %s ...\n' % self.module)
+                hide_modules = ('distutils.unixccompiler',)
+                hidden = {}
+                for m in hide_modules:
+                    if m in sys.modules:
+                        hidden[m] = sys.modules[m]
+                        del sys.modules[m]
                 doctest.DocTestSuite(self.module).run(result)
+                sys.modules.update(hidden)
         except Exception:
             result.addError(self, sys.exc_info())
             result.stopTest(self)
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to