prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path

This commit is contained in:
Benjamin Peterson 2012-05-05 17:31:05 -04:00
parent b4588f1798
commit fe1c35f8d0
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ def pytest_configure(config):
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