prepend the assertion rewriting hook, so as not to break when builtin import is explicitly on sys.meta_path
This commit is contained in:
parent
b4588f1798
commit
fe1c35f8d0
|
@ -50,7 +50,7 @@ def pytest_configure(config):
|
||||||
hook = None
|
hook = None
|
||||||
if mode == "rewrite":
|
if mode == "rewrite":
|
||||||
hook = rewrite.AssertionRewritingHook()
|
hook = rewrite.AssertionRewritingHook()
|
||||||
sys.meta_path.append(hook)
|
sys.meta_path.insert(0, hook)
|
||||||
warn_about_missing_assertion(mode)
|
warn_about_missing_assertion(mode)
|
||||||
config._assertstate = AssertionState(config, mode)
|
config._assertstate = AssertionState(config, mode)
|
||||||
config._assertstate.hook = hook
|
config._assertstate.hook = hook
|
||||||
|
|
Loading…
Reference in New Issue