=== Message If the with block contains multiple statements: Don't perform an assertion here; An exception is expected to be raised before its execution. If the assert is the only statement: Refactor this test; if this assertion's argument raises an exception, the assertion will never get executed.