This is a pytest
plugin that adds the ability to filter test cases by an
associated ticket of a tracker of your choice.
It adds:
ticket_tools
option to[pytest]
section ofpytest.ini
to define ticket tools (or trackers) of your choice@pytest.mark.ticket
mark to associate a test case with one or more tickets--ticket
command line option to filter out test cases that are not associated with selected ticket(s)
-
Enable plugin in conftest.py
pytest_plugins = ( "pytest_ticket", )
-
Define trackers in pytest.ini (comma-separated list)
[pytest] ticket_tools = bz,gh
-
Define test with ticket mark
@pytest.mark.ticket(gh=1001, bz=[2001, 2002]) def test_ticket(): pass
-
Run pytest with ticket filter
$ pytest --ticket=gh#1001
The ticket mark takes one or more keyword arguments as configured in pytest.ini
ticket_tools
option, each argument can take a single value or list of values.
@pytest.mark.ticket(tool=int | str | list[int | str], ...)
You can filter tests using the --ticket
option, which takes tool#ticket
as
an argument. This option can be passed multiple times.
pytest --ticket=tool#id --ticket=tool2#id2 ...