From 43113f9a9d45a88a7d656a99c27e94521c60dc27 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Thu, 14 Jul 2011 19:17:17 +0200 Subject: [PATCH] add some debugging tracing to assertion rewriting to understand where failures (specifically issue60) come from. --- _pytest/__init__.py | 2 +- _pytest/assertion/rewrite.py | 9 +++++++++ setup.py | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/_pytest/__init__.py b/_pytest/__init__.py index a53f8e125..dacfbd676 100644 --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.1.1.dev3' +__version__ = '2.1.1.dev4' diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 92b3392b4..dbb648e57 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -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 diff --git a/setup.py b/setup.py index 49bc3a62d..1bc050041 100644 --- a/setup.py +++ b/setup.py @@ -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'],