У меня есть мой тест:
import pytest
def test_normal():
print("normal test runned")
assert 1 == 1
@pytest.mark.production
def test_production():
print("production test runned")
assert 1 == 1
У меня есть свой conftest.py:
def pytest_addoption(parser):
try:
parser.addoption('--production', action='store_true', dest="production", default=False, help="enable production tests")
except ValueError:
print('option already set')
def pytest_configure(config):
if not config.option.production:
setattr(config.option, 'markexpr', 'not production')
Если я бегу:
pytest some_test.py -v -s
Запускается только test_normal.
Если я запускаю:
pytest some_test.py -v -s --production
Оба теста выполняются.
Как мне сделать так, чтобы эта команда выполняла оба теста:
pytest some_test.py -v -s -m 'production'