Skip to content

Make assertions before the "act" step #12572

Answered by The-Compiler
fconil asked this question in General
Discussion options

You must be logged in to vote

I think that's perfectly fine! I sometimes explicitly mark those as # sanity check so it's clearer that this is something that should never fail, and is just to ensure the test itself is actually working properly.

You could also possibly do this in a fixture, as in:

@pytest.fixture
def treatment_videos():
    # get video1 and video2 from somewhere
    assert_similar_videos(video_1, video_2)
    return video_1, video_2

def test_video_treatment(treatment_videos):
    video1, video2  = treatment_videos
    ...

which would then result in the test being marked as E (error) instead of F (failed) if that fails.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@nicoddemus
Comment options

Answer selected by fconil
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants