DEV Community


PyTest assertions

・1 min read

You have probably seen how PyTest reports errors:

def test_make_empty_file():
    name = "/tmp/empty_test"
    with open(name, "r") as fp:
    > assert not
    E assert not 'hello'
    E + where 'hello' = ()
    E      +  where = .read

But do you know how it does it? And have you ever seen the error like

assertion failed, but when it was re-run for printing intermediate values, it did not fail.

I do really recommend reading this article

Discussion (1)

codemouse92 profile image
Jason C. McDonald

Hi Konstatin,

We encourage the entire article to be published on (if you have proper rights), with a linkback if appropriate. Otherwise, we recommend original material, such as an original commentary on the article.

Posts that are simply intended to encourage readers to view an external resource are discouraged.

Thank you.

Forem Open with the Forem app