mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Added support for "socket://" and "rfc2217://" protocols using "test_port" option // Resolve #4229
This commit is contained in:
@ -44,10 +44,11 @@ Please check `Migration guide from 5.x to 6.0 <https://docs.platformio.org/en/la
|
||||
|
||||
* **Unit Testing**
|
||||
|
||||
- New `Unit Testing <https://docs.platformio.org/en/latest/advanced/unit-testing/index.html>`_ solution and documentation
|
||||
- Refactored from scratch `Unit Testing <https://docs.platformio.org/en/latest/advanced/unit-testing/index.html>`_ solution and its documentation
|
||||
- New `Test Hierarchies <https://docs.platformio.org/en/latest/advanced/unit-testing/structure.html>`_ (`issue #4135 <https://github.com/platformio/platformio-core/issues/4135>`_)
|
||||
- New `Custom Testing Framework <https://docs.platformio.org/en/latest/advanced/unit-testing/frameworks/custom/index.html>`_
|
||||
- New "test" `build configuration <https://docs.platformio.org/en/latest/projectconf/build_configurations.html>`__
|
||||
- Added support for ``socket://`` and ``rfc2217://`` protocols using `test_port <https://docs.platformio.org/en/latest/projectconf/section_env_test.html#test-port>`__ option (`issue #4229 <https://github.com/platformio/platformio-core/issues/4229>`_)
|
||||
- Generate reports in JUnit and JSON formats using the `pio test --output-format <https://docs.platformio.org/en/latest/core/userguide/cmd_test.html#cmdoption-pio-test-output-format>`__ option (`issue #2891 <https://github.com/platformio/platformio-core/issues/2891>`_)
|
||||
- Provide more information when the native program crashed on a host (errored with a negative return code) (`issue #3429 <https://github.com/platformio/platformio-core/issues/3429>`_)
|
||||
- Fixed an issue when command line parameters (``--ignore``, ``--filter``) do not override values defined in the |PIOCONF| (`issue #3845 <https://github.com/platformio/platformio-core/issues/3845>`_)
|
||||
|
2
docs
2
docs
Submodule docs updated: 7133d09272...37f04cb5e6
@ -76,6 +76,11 @@ class TestRunnerBase:
|
||||
self.project_config.get(f"env:{self.test_suite.env_name}", "test_speed")
|
||||
)
|
||||
|
||||
def get_test_port(self):
|
||||
return self.options.test_port or self.project_config.get(
|
||||
f"env:{self.test_suite.env_name}", "test_port"
|
||||
)
|
||||
|
||||
def start(self, cmd_ctx):
|
||||
# setup command context
|
||||
self.cmd_ctx = cmd_ctx
|
||||
@ -138,9 +143,11 @@ class TestRunnerBase:
|
||||
if self.options.without_testing:
|
||||
return None
|
||||
click.secho("Testing...", bold=self.options.verbose)
|
||||
test_port = self.get_test_port()
|
||||
serial_conds = [self.platform.is_embedded(), test_port and "://" in test_port]
|
||||
reader = (
|
||||
SerialTestOutputReader(self)
|
||||
if self.platform.is_embedded()
|
||||
if any(serial_conds)
|
||||
else ProgramTestOutputReader(self)
|
||||
)
|
||||
return reader.begin()
|
||||
|
@ -36,10 +36,12 @@ class SerialTestOutputReader:
|
||||
click.echo()
|
||||
|
||||
try:
|
||||
ser = serial.Serial(
|
||||
baudrate=self.test_runner.get_test_speed(), timeout=self.SERIAL_TIMEOUT
|
||||
ser = serial.serial_for_url(
|
||||
self.test_runner.get_test_port() or self.autodetect_test_port(),
|
||||
do_not_open=True,
|
||||
baudrate=self.test_runner.get_test_speed(),
|
||||
timeout=self.SERIAL_TIMEOUT,
|
||||
)
|
||||
ser.port = self.get_test_port()
|
||||
ser.rts = self.test_runner.options.monitor_rts
|
||||
ser.dtr = self.test_runner.options.monitor_dtr
|
||||
ser.open()
|
||||
@ -74,17 +76,7 @@ class SerialTestOutputReader:
|
||||
self.test_runner.on_test_output(line)
|
||||
ser.close()
|
||||
|
||||
def get_test_port(self):
|
||||
# if test port is specified manually or in config
|
||||
port = (
|
||||
self.test_runner.options.test_port
|
||||
or self.test_runner.project_config.get(
|
||||
f"env:{self.test_runner.test_suite.env_name}", "test_port"
|
||||
)
|
||||
)
|
||||
if port:
|
||||
return port
|
||||
|
||||
def autodetect_test_port(self):
|
||||
board = self.test_runner.project_config.get(
|
||||
f"env:{self.test_runner.test_suite.env_name}", "board"
|
||||
)
|
||||
|
Reference in New Issue
Block a user