File size: 1,006 Bytes
9dce458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pytest

# https://docs.pytest.org/en/6.2.x/example/simple.html?highlight=addoption#pass-different-values-to-a-test-function-depending-on-command-line-options
def pytest_addoption(parser):
    parser.addoption('--translator', action='store', default=None, help='Chosen translator for test run')
    parser.addoption('--target-lang', action='store', default='ENG', help='Target language for translator test run')
    parser.addoption('--text', action='store', default=None, help='Text to be used for translation test run')
    parser.addoption('--count', action='store', type=int, default=1, help='Amount of times the test should be repeated')

@pytest.fixture
def translator(request):
    return request.config.getoption('--translator')

@pytest.fixture
def tgt_lang(request):
    return request.config.getoption('--target-lang')
    
@pytest.fixture
def text(request):
    return request.config.getoption('--text')

@pytest.fixture
def count(request):
    return request.config.getoption('--count')