[Python] How can I run only tests with specific marker attribute in Pytest?

Discussão em 'Python' iniciado por Stack, Novembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I'm using @pytest.mark to uniquely identify specific tests, therefore I created my custom marker.

    @pytest.mark.key


    I'm using it as such:

    @pytest.mark.key("test-001")
    def test_simple(self):
    self.passing_step()
    self.passing_step()
    self.passing_step()
    self.passing_step()
    assert True


    Now from the console I would like to run all tests with the marked key "test-001". How can I achieve this?

    What i'm looking for is something like this:

    pypi.org/project/pytest-jira/0.3.6


    where a test can be mapped to a Jira key. I looked at the source code for the link but i'm unsure how to achieve it in order for me to run specific tests. Say I only wanna run the test with the key "test-001".

    Continue reading...

Compartilhe esta Página