Skip to content

Commit

Permalink
feat(serial): fixture baud move to service serial
Browse files Browse the repository at this point in the history
  • Loading branch information
hfudev committed Jul 18, 2022
1 parent 0100033 commit 9d692ee
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions pytest-embedded/pytest_embedded/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ def pytest_addoption(parser):

serial_group = parser.getgroup('embedded-serial')
serial_group.addoption('--port', help='serial port. (Env: "ESPPORT" if service "esp" specified, Default: "None")')
serial_group.addoption(
'--baud',
help='serial port baud rate used when flashing. (Env: "ESPBAUD" if service "esp" specified, Default: 115200)',
)

esp_group = parser.getgroup('embedded-esp')
esp_group.addoption('--target', help='serial target chip type. (Default: "auto")')
esp_group.addoption('--baud', help='serial port baud rate used when flashing. (Env: "ESPBAUD", Default: 115200)')
esp_group.addoption(
'--skip-autoflash',
help='y/yes/true for True and n/no/false for False. Set to True to disable auto flash. (Default: False)',
Expand Down Expand Up @@ -552,21 +555,21 @@ def port(request: FixtureRequest) -> Optional[str]:
return _request_param_or_config_option_or_default(request, 'port', None)


#######
# esp #
#######
@pytest.fixture
@multi_dut_argument
def target(request: FixtureRequest) -> Optional[str]:
def baud(request: FixtureRequest) -> Optional[str]:
"""Enable parametrization for the same cli option"""
return _request_param_or_config_option_or_default(request, 'target', None)
return _request_param_or_config_option_or_default(request, 'baud', None)


#######
# esp #
#######
@pytest.fixture
@multi_dut_argument
def baud(request: FixtureRequest) -> Optional[str]:
def target(request: FixtureRequest) -> Optional[str]:
"""Enable parametrization for the same cli option"""
return _request_param_or_config_option_or_default(request, 'baud', None)
return _request_param_or_config_option_or_default(request, 'target', None)


@pytest.fixture
Expand Down Expand Up @@ -843,6 +846,7 @@ def _fixture_classes_and_options(
kwargs[fixture] = {
'pexpect_proc': pexpect_proc,
'port': port,
'baud': baud,
}
elif fixture in ['openocd', 'gdb']:
if 'jtag' in _services:
Expand Down

0 comments on commit 9d692ee

Please sign in to comment.