[py-svn] commit/pytest: gutworth: prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path

Bitbucket commits-noreply at bitbucket.org
Sat May 5 23:31:13 CEST 2012


1 new commit in pytest:


https://bitbucket.org/hpk42/pytest/changeset/1ab662c89077/
changeset:   1ab662c89077
user:        gutworth
date:        2012-05-05 23:31:05
summary:     prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path
affected #:  1 file

diff -r 7d6e61e16b40e169ce8781bbecbc0da201dcb85e -r 1ab662c89077009ac5f7a66622e77e85b87c6e0c _pytest/assertion/__init__.py
--- a/_pytest/assertion/__init__.py
+++ b/_pytest/assertion/__init__.py
@@ -50,7 +50,7 @@
     hook = None
     if mode == "rewrite":
         hook = rewrite.AssertionRewritingHook()
-        sys.meta_path.append(hook)
+        sys.meta_path.insert(0, hook)
     warn_about_missing_assertion(mode)
     config._assertstate = AssertionState(config, mode)
     config._assertstate.hook = hook

Repository URL: https://bitbucket.org/hpk42/pytest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the pytest-commit mailing list