diff --git a/_pytest/assertion/rewrite.py b/_pytest/assertion/rewrite.py index 95bf4117d..589dc07d2 100644 --- a/_pytest/assertion/rewrite.py +++ b/_pytest/assertion/rewrite.py @@ -308,7 +308,10 @@ def _read_pyc(source, pyc): if (len(data) != 8 or data[:4] != imp.get_magic() or struct.unpack(" strip_bytes + pyc.write(contents[:strip_bytes], mode='wb') + + assert _read_pyc(source, str(pyc)) is None # no error