mirror of
https://github.com/scito/extract_otp_secret_keys
synced 2024-11-10 07:10:40 +00:00
22 lines
784 B
Python
22 lines
784 B
Python
from typing import Any
|
|
|
|
import pytest
|
|
|
|
|
|
def pytest_addoption(parser: pytest.Parser) -> None:
|
|
parser.addoption("--relaxed", action='store_true', help="run tests in relaxed mode")
|
|
parser.addoption("--fast", action="store_true", help="faster execution, do not run all combinations")
|
|
|
|
|
|
@pytest.fixture
|
|
def relaxed(request: pytest.FixtureRequest) -> Any:
|
|
return request.config.getoption("--relaxed")
|
|
|
|
|
|
def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
|
|
if "qr_mode" in metafunc.fixturenames:
|
|
all_qr_modes = ['ZBAR', 'QREADER', 'QREADER_DEEP', 'CV2', 'CV2_WECHAT']
|
|
number = 2 if metafunc.config.getoption("fast") else len(all_qr_modes)
|
|
qr_modes = [mode for mode in all_qr_modes]
|
|
metafunc.parametrize("qr_mode", qr_modes[0:number])
|