Интересно, как выбрать подмножество моих тестов с использованием pytest пользовательских маркеровКак выбрать подмножество тестов в pytest с помощью пользовательских маркеров на Params
Простой тест работает, как ожидалось:
код с одним заметное параметр
import pytest
@pytest.mark.parametrize('a', [pytest.mark.my_custom_marker(0), 1])
@pytest.mark.parametrize('b', [0, 1])
def test_increment(a, b):
pass
Если я только хочу, чтобы запустить тест, помеченные 'my_custom_marker'
Выход
$ pytest test_machin.py -m my_custom_marker --collect-only
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/mvelay/workspace/sandbox, inifile:
plugins: hypothesis-3.6.0, html-1.12.0, xdist-1.15.0, timeout-1.0.0
collected 4 items
<Module 'test_machin.py'>
<Function 'test_increment[0-0]'>
<Function 'test_increment[0-1]'>
Но как только я пытаюсь проверить мульти отмеченных параметров, я столкнулся вопрос
кода с двумя маркированными параметрами при
import pytest
@pytest.mark.parametrize('a', [pytest.mark.my_custom_marker(0), 1])
@pytest.mark.parametrize('b', [pytest.mark.my_custom_marker(0), 1])
def test_increment(a, b):
pass
Выходных
$ pytest -m my_custom_marker test_machin.py --collect-only
platform linux2 -- Python 2.7.12, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /home/mvelay/workspace/sandbox, inifile:
plugins: hypothesis-3.6.0, html-1.12.0, xdist-1.15.0, timeout-1.0.0
collected 4 items
<Module 'test_machin.py'>
<Function 'test_increment[0-0]'>
<Function 'test_increment[0-1]'>
<Function 'test_increment[1-0]'>
Ожидалось, что только комбинация [0-0] бежит.
Есть ли способ сделать это элегантным способом?