add some debugging tracing to assertion rewriting to understand where failures (specifically issue60) come from.

This commit is contained in:
holger krekel 2011-07-14 19:17:17 +02:00
parent 650c3bcfde
commit 43113f9a9d
3 changed files with 11 additions and 2 deletions

View File

@ -1,2 +1,2 @@
#
__version__ = '2.1.1.dev3'
__version__ = '2.1.1.dev4'

View File

@ -44,6 +44,7 @@ class AssertionRewritingHook(object):
return None
sess = self.session
state = sess.config._assertstate
state.trace("find_module called for: %s" % name)
names = name.rsplit(".", 1)
lastname = names[-1]
pth = None
@ -76,11 +77,14 @@ class AssertionRewritingHook(object):
try:
for pat in self.fnpats:
if fn_pypath.fnmatch(pat):
state.trace("matched test file %r" % (fn,))
break
else:
return None
finally:
self.session = sess
else:
state.trace("matched test file (was specified on cmdline): %r" % (fn,))
# The requested module looks like a test file, so rewrite it. This is
# the most magical part of the process: load the source, rewrite the
# asserts, and load the rewritten source. We also cache the rewritten
@ -97,6 +101,11 @@ class AssertionRewritingHook(object):
except py.error.EACCES:
state.trace("read only directory: %r" % (fn_pypath.dirname,))
write = False
except py.error.EEXIST:
state.trace("failure to create directory: %r" % (
fn_pypath.dirname,))
raise
#write = False
cache_name = fn_pypath.basename[:-3] + "." + PYTEST_TAG + ".pyc"
pyc = os.path.join(cache_dir, cache_name)
# Notice that even if we're in a read-only directory, I'm going to check

View File

@ -24,7 +24,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.1.1.dev3',
version='2.1.1.dev4',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],