add some debugging tracing to assertion rewriting to understand where failures (specifically issue60) come from.
This commit is contained in:
		
							parent
							
								
									650c3bcfde
								
							
						
					
					
						commit
						43113f9a9d
					
				|  | @ -1,2 +1,2 @@ | ||||||
| # | # | ||||||
| __version__ = '2.1.1.dev3' | __version__ = '2.1.1.dev4' | ||||||
|  |  | ||||||
|  | @ -44,6 +44,7 @@ class AssertionRewritingHook(object): | ||||||
|             return None |             return None | ||||||
|         sess = self.session |         sess = self.session | ||||||
|         state = sess.config._assertstate |         state = sess.config._assertstate | ||||||
|  |         state.trace("find_module called for: %s" % name) | ||||||
|         names = name.rsplit(".", 1) |         names = name.rsplit(".", 1) | ||||||
|         lastname = names[-1] |         lastname = names[-1] | ||||||
|         pth = None |         pth = None | ||||||
|  | @ -76,11 +77,14 @@ class AssertionRewritingHook(object): | ||||||
|             try: |             try: | ||||||
|                 for pat in self.fnpats: |                 for pat in self.fnpats: | ||||||
|                     if fn_pypath.fnmatch(pat): |                     if fn_pypath.fnmatch(pat): | ||||||
|  |                         state.trace("matched test file %r" % (fn,)) | ||||||
|                         break |                         break | ||||||
|                 else: |                 else: | ||||||
|                     return None |                     return None | ||||||
|             finally: |             finally: | ||||||
|                 self.session = sess |                 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 requested module looks like a test file, so rewrite it. This is | ||||||
|         # the most magical part of the process: load the source, rewrite the |         # the most magical part of the process: load the source, rewrite the | ||||||
|         # asserts, and load the rewritten source. We also cache the rewritten |         # asserts, and load the rewritten source. We also cache the rewritten | ||||||
|  | @ -97,6 +101,11 @@ class AssertionRewritingHook(object): | ||||||
|             except py.error.EACCES: |             except py.error.EACCES: | ||||||
|                 state.trace("read only directory: %r" % (fn_pypath.dirname,)) |                 state.trace("read only directory: %r" % (fn_pypath.dirname,)) | ||||||
|                 write = False |                 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" |         cache_name = fn_pypath.basename[:-3] + "." + PYTEST_TAG + ".pyc" | ||||||
|         pyc = os.path.join(cache_dir, cache_name) |         pyc = os.path.join(cache_dir, cache_name) | ||||||
|         # Notice that even if we're in a read-only directory, I'm going to check |         # Notice that even if we're in a read-only directory, I'm going to check | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								setup.py
								
								
								
								
							
							
						
						
									
										2
									
								
								setup.py
								
								
								
								
							|  | @ -24,7 +24,7 @@ def main(): | ||||||
|         name='pytest', |         name='pytest', | ||||||
|         description='py.test: simple powerful testing with Python', |         description='py.test: simple powerful testing with Python', | ||||||
|         long_description = long_description, |         long_description = long_description, | ||||||
|         version='2.1.1.dev3', |         version='2.1.1.dev4', | ||||||
|         url='http://pytest.org', |         url='http://pytest.org', | ||||||
|         license='MIT license', |         license='MIT license', | ||||||
|         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], |         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue