pytest-embedded-serial 2.4.0__tar.gz → 2.6.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytest-embedded-serial
3
- Version: 2.4.0
3
+ Version: 2.6.0
4
4
  Summary: Make pytest-embedded plugin work with Serial.
5
5
  Author-email: Fu Hanxi <fuhanxi@espressif.com>
6
6
  Requires-Python: >=3.10
@@ -19,7 +19,7 @@ Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Programming Language :: Python
20
20
  Classifier: Topic :: Software Development :: Testing
21
21
  License-File: LICENSE
22
- Requires-Dist: pytest-embedded~=2.4.0
22
+ Requires-Dist: pytest-embedded~=2.6.0
23
23
  Requires-Dist: pyserial~=3.0
24
24
  Project-URL: changelog, https://github.com/espressif/pytest-embedded/blob/main/CHANGELOG.md
25
25
  Project-URL: documentation, https://docs.espressif.com/projects/pytest-embedded/en/latest/
@@ -28,7 +28,7 @@ dynamic = ["version", "description"]
28
28
  requires-python = ">=3.10"
29
29
 
30
30
  dependencies = [
31
- "pytest-embedded~=2.4.0",
31
+ "pytest-embedded~=2.6.0",
32
32
  "pyserial~=3.0",
33
33
  ]
34
34
 
@@ -8,4 +8,4 @@ __all__ = [
8
8
  'SerialDut',
9
9
  ]
10
10
 
11
- __version__ = '2.4.0'
11
+ __version__ = '2.6.0'
@@ -144,7 +144,7 @@ class Serial:
144
144
  logging.debug(f'released {port}')
145
145
 
146
146
  @contextlib.contextmanager
147
- def disable_redirect_thread(self) -> bool:
147
+ def disable_redirect_thread(self, kill_port: bool = False) -> bool:
148
148
  """
149
149
  kill the redirect thread, and start a new one after got yield back
150
150
 
@@ -152,10 +152,14 @@ class Serial:
152
152
  True if redirect serial thread has been terminated
153
153
  """
154
154
  killed = self.stop_redirect_thread()
155
+ if kill_port:
156
+ self.proc.close()
155
157
 
156
158
  yield killed
157
159
 
158
160
  if killed:
161
+ if kill_port:
162
+ self._start()
159
163
  self.start_redirect_thread()
160
164
 
161
165