Skip to content

How to run several parametrized test cases #8342

Answered by bluetech
LuriaA asked this question in Q&A
Discussion options

You must be logged in to vote

I used this file

import pytest


class TestLogin:
    @pytest.mark.parametrize(
        'creds',
        [('foo', ''), ('foo', 'invalid_pass'), ('invalid_user', 'bar')],
        ids=['empty_pass', 'wrong_pass', 'wrong_user'],
    )
    def test_login_fail(self, creds) -> None:
        pass

and your last attempt works for me:

$ pytest x.py -v -k "test_login_fail[wrong_user] or test_login_fail[empty_pass]"
==================================================================================== test session starts =====================================================================================
platform linux -- Python 3.7.7, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
cachedir: .pytest_cache
col…

Replies: 1 comment 1 reply

Comment options

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

Answer selected by LuriaA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants