pytest-embedded-serial-esp 2.9.3__tar.gz → 2.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,71 @@
1
+ Metadata-Version: 2.4
2
+ Name: pytest-embedded-serial-esp
3
+ Version: 2.10.0
4
+ Summary: Make pytest-embedded plugin work with Espressif target boards.
5
+ Author-email: Fu Hanxi <fuhanxi@espressif.com>
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 5 - Production/Stable
9
+ Classifier: Framework :: Pytest
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Topic :: Software Development :: Testing
22
+ License-File: LICENSE
23
+ Requires-Dist: pytest-embedded-serial~=2.10.0
24
+ Requires-Dist: esptool>=5.2,<6
25
+ Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
26
+ Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
27
+ Project-URL: homepage, https://github.com/espressif/pytest-embedded
28
+ Project-URL: repository, https://github.com/espressif/pytest-embedded
29
+
30
+ ### pytest-embedded-serial-esp
31
+
32
+ A `pytest-embedded` service that extends `pytest-embedded-serial` with [esptool](https://github.com/espressif/esptool) integration for Espressif SoCs (ESP32 series).
33
+
34
+ #### Service Activation
35
+
36
+ Activate this service by passing `esp` to `--embedded-services`:
37
+
38
+ ```shell
39
+ pytest --embedded-services esp --app-path /path/to/app
40
+ ```
41
+
42
+ #### Extra Functionalities
43
+
44
+ - **Automatic Chip & Port Detection**: Uses `esptool` to query the connected chip and automatically detect the chip model (e.g. `esp32`, `esp32c3`, `esp32s3`) and available serial ports.
45
+ - **Device Filtering**: Disambiguate multiple connected development boards by MAC address or USB serial number.
46
+ - **Flashing Controls**: Configure flashing baud rate, force mode, full flash erasure, or separate flash and monitor ports.
47
+
48
+ #### CLI Options
49
+
50
+ - `--target`: Expected target chip type. Default: `"auto"`.
51
+ - `--beta-target`: Beta version target chip type. Default: same as `--target`.
52
+ - `--flash-port`: Dedicated serial port for flashing when separate from the monitoring port. Default: `None`.
53
+ - `--port-mac`: Expected MAC address of the target board. Default: `None`.
54
+ - `--port-serial-number`: Comma-separated list of USB serial numbers to filter available ports. Default: `None`.
55
+ - `--esptool-baud`: Baud rate used during flashing. Default: `921600` (or `ESPBAUD` environment variable).
56
+ - `--skip-autoflash`: Skip automatically flashing the binary to target flash. Default: `False`.
57
+ - `--erase-all`: Erase the entire flash chip before writing binaries. Default: `False`.
58
+ - `--esp-flash-force`: Force flashing mode in `esptool`. Default: `False`.
59
+ - `--add-target-as-marker-with-amount`: Attach target chip as a test marker. Default: `False`.
60
+
61
+ #### Quick Example
62
+
63
+ ```python
64
+ from pytest_embedded import Dut
65
+
66
+
67
+ def test_chip_info(dut: Dut):
68
+ print(f'Connected to target chip: {dut.app.target}')
69
+ dut.expect('Hello world!')
70
+ ```
71
+
@@ -0,0 +1,41 @@
1
+ ### pytest-embedded-serial-esp
2
+
3
+ A `pytest-embedded` service that extends `pytest-embedded-serial` with [esptool](https://github.com/espressif/esptool) integration for Espressif SoCs (ESP32 series).
4
+
5
+ #### Service Activation
6
+
7
+ Activate this service by passing `esp` to `--embedded-services`:
8
+
9
+ ```shell
10
+ pytest --embedded-services esp --app-path /path/to/app
11
+ ```
12
+
13
+ #### Extra Functionalities
14
+
15
+ - **Automatic Chip & Port Detection**: Uses `esptool` to query the connected chip and automatically detect the chip model (e.g. `esp32`, `esp32c3`, `esp32s3`) and available serial ports.
16
+ - **Device Filtering**: Disambiguate multiple connected development boards by MAC address or USB serial number.
17
+ - **Flashing Controls**: Configure flashing baud rate, force mode, full flash erasure, or separate flash and monitor ports.
18
+
19
+ #### CLI Options
20
+
21
+ - `--target`: Expected target chip type. Default: `"auto"`.
22
+ - `--beta-target`: Beta version target chip type. Default: same as `--target`.
23
+ - `--flash-port`: Dedicated serial port for flashing when separate from the monitoring port. Default: `None`.
24
+ - `--port-mac`: Expected MAC address of the target board. Default: `None`.
25
+ - `--port-serial-number`: Comma-separated list of USB serial numbers to filter available ports. Default: `None`.
26
+ - `--esptool-baud`: Baud rate used during flashing. Default: `921600` (or `ESPBAUD` environment variable).
27
+ - `--skip-autoflash`: Skip automatically flashing the binary to target flash. Default: `False`.
28
+ - `--erase-all`: Erase the entire flash chip before writing binaries. Default: `False`.
29
+ - `--esp-flash-force`: Force flashing mode in `esptool`. Default: `False`.
30
+ - `--add-target-as-marker-with-amount`: Attach target chip as a test marker. Default: `False`.
31
+
32
+ #### Quick Example
33
+
34
+ ```python
35
+ from pytest_embedded import Dut
36
+
37
+
38
+ def test_chip_info(dut: Dut):
39
+ print(f'Connected to target chip: {dut.app.target}')
40
+ dut.expect('Hello world!')
41
+ ```
@@ -29,7 +29,7 @@ dynamic = ["version", "description"]
29
29
  requires-python = ">=3.10"
30
30
 
31
31
  dependencies = [
32
- "pytest-embedded-serial~=2.9.3",
32
+ "pytest-embedded-serial~=2.10.0",
33
33
  "esptool>=5.2,<6",
34
34
  ]
35
35
 
@@ -6,4 +6,4 @@ __all__ = [
6
6
  'EspSerial',
7
7
  ]
8
8
 
9
- __version__ = '2.9.3'
9
+ __version__ = '2.10.0'
@@ -59,23 +59,20 @@ class EspSerial(Serial):
59
59
  esptool_target = beta_target or target or 'auto'
60
60
  if port is None or port.endswith('*'):
61
61
  port_filter = port.strip('*') if port else ''
62
- available_ports = [_p for _p in esptool.get_port_list(**filters) if port_filter in _p]
63
- ports = list(set(available_ports) - set(self.occupied_ports.keys()) - set(ports_to_occupy))
64
-
65
- # sort to make /dev/ttyS* ports before /dev/ttyUSB* ports
66
- # esptool will reverse the list
67
- ports.sort()
62
+ occupied = set(self.occupied_ports) | set(ports_to_occupy)
63
+ # get_port_list() is already the try-order: Espressif VID, then ttyUSB/ttyACM, then ttyS*.
64
+ ports = [p for p in esptool.get_port_list(**filters) if port_filter in p and p not in occupied]
68
65
  if port_mac:
69
- for port in ports:
70
- if _is_port_mac_verified(pexpect_proc, port, port_mac, msg_queue):
71
- ports = [port]
66
+ for candidate in ports:
67
+ if _is_port_mac_verified(pexpect_proc, candidate, port_mac, msg_queue):
68
+ ports = [candidate]
72
69
  break
73
70
  else:
74
71
  raise ValueError(f'The specified MAC address {port_mac} cannot be found.')
75
72
 
76
- # prioritize the cache recorded target port
73
+ # Cache hits first, preserving get_port_list() order within each group.
77
74
  if esptool_target and self._meta:
78
- ports.sort(key=lambda x: self._meta.hit_port_target_cache(x, esptool_target))
75
+ ports.sort(key=lambda p: self._meta.hit_port_target_cache(p, esptool_target), reverse=True)
79
76
 
80
77
  logging.debug(f'Detecting ports from {", ".join(ports)}')
81
78
  else:
@@ -1,37 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: pytest-embedded-serial-esp
3
- Version: 2.9.3
4
- Summary: Make pytest-embedded plugin work with Espressif target boards.
5
- Author-email: Fu Hanxi <fuhanxi@espressif.com>
6
- Requires-Python: >=3.10
7
- Description-Content-Type: text/markdown
8
- Classifier: Development Status :: 5 - Production/Stable
9
- Classifier: Framework :: Pytest
10
- Classifier: Intended Audience :: Developers
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Programming Language :: Python :: 3 :: Only
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
19
- Classifier: Programming Language :: Python :: 3.14
20
- Classifier: Programming Language :: Python
21
- Classifier: Topic :: Software Development :: Testing
22
- License-File: LICENSE
23
- Requires-Dist: pytest-embedded-serial~=2.9.3
24
- Requires-Dist: esptool>=5.2,<6
25
- Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
26
- Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
27
- Project-URL: homepage, https://github.com/espressif/pytest-embedded
28
- Project-URL: repository, https://github.com/espressif/pytest-embedded
29
-
30
- ### pytest-embedded-serial-esp
31
-
32
- pytest embedded service for testing espressif boards via serial ports
33
-
34
- Extra Functionalities:
35
-
36
- - `serial`: detect and confirm target and port by `esptool` automatically.
37
-
@@ -1,7 +0,0 @@
1
- ### pytest-embedded-serial-esp
2
-
3
- pytest embedded service for testing espressif boards via serial ports
4
-
5
- Extra Functionalities:
6
-
7
- - `serial`: detect and confirm target and port by `esptool` automatically.