[PEAK] setuptools: Test works only after second invocation

Nikolaus Rath Nikolaus at rath.org
Thu Apr 29 12:34:22 EDT 2010


On 04/29/2010 12:10 PM, P.J. Eby wrote:
> At 11:47 AM 4/29/2010 -0400, Nikolaus Rath wrote:
>>   File "/home/nikratio/bla/src/s3ql/block_cache.py", line 1, in <module>
>>     class CacheEntry(file):
>> TypeError: Error when calling the metaclass bases
>>     cannot create 'builtin_function_or_method' instances
> 
> It's a bug in setuptools.sandbox that's swapping the 'file' and 'open'
> builtins after doing an install from source; I've now fixed it in svn.
> 
> Thanks for the bug report!  It's unlikely I'd have found out about this
> one any other way.

You're welcome. Took me quite a while to figure this one out :-).


Is setuptools by any chance doing more of this kind of black magic? I'm about to start debugging a second, even more mysterious looking problem when running the test command. If it is used in combination with Psyco, I get exceptions after all the tests have completed:

runTest (tests.t4_fuse.fuse_tests) ... ok

----------------------------------------------------------------------
Ran 77 tests in 9.317s

OK (skipped=10)
Exception TypeError: "'NoneType' object is not callable" in <frame object at 0x93079b4> ignored
Exception TypeError: "'NoneType' object is not callable" in <frame object at 0x93079b4> ignored
Unhandled exception in alarm:
Error in sys.excepthook:
Traceback (most recent call last):
  File "/home/nikratio/projekte/s3ql/src/s3ql/common.py", line 336, in log_main
    exc_info=a)
  File "/usr/lib/python2.6/logging/__init__.py", line 1074, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.6/logging/__init__.py", line 1156, in _log
    fn, lno, func = self.findCaller()
  File "/usr/lib/python2.6/logging/__init__.py", line 1118, in findCaller
    f = currentframe()
  File "/usr/lib/python2.6/logging/__init__.py", line 76, in <lambda>
    if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)
  File "/usr/lib/python2.6/dist-packages/psyco/support.py", line 161, in _getframe
    return embedframe(_psyco.getframe(depth+1))
AttributeError: 'NoneType' object has no attribute 'getframe'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/psyco/profiler.py", line 315, in do_profile
    _psyco.statcollect()
AttributeError: 'NoneType' object has no attribute 'statcollect'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.6/dist-packages/psyco/profiler.py", line 38, in go
    go_lock.acquire()
AttributeError: 'NoneType' object has no attribute 'acquire'
Error in sys.exitfunc:
Error in sys.excepthook:
Traceback (most recent call last):
  File "/home/nikratio/projekte/s3ql/src/s3ql/common.py", line 336, in log_main
    exc_info=a)
  File "/usr/lib/python2.6/logging/__init__.py", line 1074, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python2.6/logging/__init__.py", line 1156, in _log
    fn, lno, func = self.findCaller()
  File "/usr/lib/python2.6/logging/__init__.py", line 1118, in findCaller
    f = currentframe()
  File "/usr/lib/python2.6/logging/__init__.py", line 76, in <lambda>
    if hasattr(sys, '_getframe'): currentframe = lambda: sys._getframe(3)
  File "/usr/lib/python2.6/dist-packages/psyco/support.py", line 161, in _getframe
    return embedframe(_psyco.getframe(depth+1))
AttributeError: 'NoneType' object has no attribute 'getframe'

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/usr/lib/python2.6/dist-packages/psyco/profiler.py", line 38, in go
    go_lock.acquire()
AttributeError: 'NoneType' object has no attribute 'acquire'

 
> Anyway, Upgrade with 'easy_install setuptools==dev06' to get the fixed
> version.

Is there also an ez_setup.py available that downloads this (or any newer release) automatically? I don't want to require people to first manually upgrade setuptools..

Or is it possible to work around this problem somehow? Is the original file class backed up somewhere, so that I can refer to the backup?


Best,

   -Nikolaus

-- 
 »Time flies like an arrow, fruit flies like a Banana.«

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C


More information about the PEAK mailing list