Skip to content

Select tests according to their mark #50

Closed
@pytestbot

Description

@pytestbot

Originally reported by: David Burns (BitBucket: AutomatedTester, GitHub: AutomatedTester)


Currently the only way to sort through tests is with the -k option. Unfortunately this also looks at the method name which can run tests you don't want/expect.

For example

#!python



@pytest.mark.staging
def test_omg_dont_run_on_prod(self):
    pass

@pytest.mark.prod
def test_basics_still_work(self):
    pass


py.test -k prod #Runs the tests above even though the first one is marked as staging

It would be great if we could add a -m option that only looks at the marks.

so if I did py.test -m prod only the second test would be run.


Metadata

Metadata

Assignees

No one assigned

    Labels

    type: enhancementnew feature or API change, should be merged into features branch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions