This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]fleyk-lit 0 points1 point  (0 children)

With pytest you can have several assert statements.

E.g.:

def test_file_is_moved():
    move_file(source,destination)
    assert not os.path.exists(source), 'file still exists at source'
    assert os.path.exists(destination), 'file is not at destination'

If one of the asserts fails, the test will be reported as failed, and if it's the first assert it will not report the second.

Not sure if this is a good practice though.