pytest-embedded 1.3.0__tar.gz → 1.3.1__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.
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/PKG-INFO +1 -5
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/README.md +0 -4
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/dut.py +14 -12
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/log.py +8 -11
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/plugin.py +2 -2
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/utils.py +43 -37
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/PKG-INFO +1 -5
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/__init__.py +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/app.py +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded/unity.py +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/SOURCES.txt +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/dependency_links.txt +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/entry_points.txt +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/requires.txt +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/top_level.txt +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/setup.cfg +0 -0
- {pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: pytest-embedded
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: pytest embedded plugin
|
|
5
5
|
Home-page: https://docs.espressif.com/projects/pytest-embedded/en/latest/
|
|
6
6
|
Author: Fu Hanxi
|
|
@@ -10,10 +10,6 @@ Description: ### pytest-embedded
|
|
|
10
10
|
|
|
11
11
|
A pytest plugin for embedded systems. Could activate different services for extra functionalities.
|
|
12
12
|
|
|
13
|
-
Used CLI Options:
|
|
14
|
-
|
|
15
|
-
- `app_path`
|
|
16
|
-
|
|
17
13
|
Platform: UNKNOWN
|
|
18
14
|
Classifier: Framework :: Pytest
|
|
19
15
|
Classifier: Intended Audience :: Developers
|
|
@@ -101,7 +101,7 @@ class Dut(_InjectMixinCls):
|
|
|
101
101
|
@_pexpect_func # noqa
|
|
102
102
|
def expect(self, pattern, **kwargs) -> Match: # noqa
|
|
103
103
|
"""
|
|
104
|
-
Expect the `pattern` from the internal buffer. All the arguments
|
|
104
|
+
Expect the `pattern` from the internal buffer. All the arguments will be passed to `pexpect.expect()`.
|
|
105
105
|
|
|
106
106
|
Args:
|
|
107
107
|
pattern: string, or compiled regex, or a list of string and compiled regex.
|
|
@@ -112,16 +112,17 @@ class Dut(_InjectMixinCls):
|
|
|
112
112
|
Otherwise match any of them could pass
|
|
113
113
|
|
|
114
114
|
Returns:
|
|
115
|
-
|
|
115
|
+
`AnyStr` or `re.Match`
|
|
116
116
|
|
|
117
|
-
|
|
117
|
+
- `AnyStr`: if you're matching `pexpect.EOF` or `pexpect.TIMEOUT` to get all the current buffers.
|
|
118
|
+
- `re.Match`: if matched given string.
|
|
118
119
|
"""
|
|
119
120
|
return self.pexpect_proc.expect(pattern, **kwargs)
|
|
120
121
|
|
|
121
122
|
@_pexpect_func # noqa
|
|
122
123
|
def expect_exact(self, pattern, **kwargs) -> Match: # noqa
|
|
123
124
|
"""
|
|
124
|
-
Expect the `pattern` from the internal buffer. All the arguments
|
|
125
|
+
Expect the `pattern` from the internal buffer. All the arguments will be passed to `pexpect.expect_exact()`.
|
|
125
126
|
|
|
126
127
|
Args:
|
|
127
128
|
pattern: string, or a list of string
|
|
@@ -132,9 +133,10 @@ class Dut(_InjectMixinCls):
|
|
|
132
133
|
Otherwise match any of them could pass
|
|
133
134
|
|
|
134
135
|
Returns:
|
|
135
|
-
|
|
136
|
+
`AnyStr` or `re.Match`
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
- `AnyStr`: if you're matching `pexpect.EOF` or `pexpect.TIMEOUT` to get all the current buffers.
|
|
139
|
+
- `re.Match`: if matched given string.
|
|
138
140
|
"""
|
|
139
141
|
return self.pexpect_proc.expect_exact(pattern, **kwargs)
|
|
140
142
|
|
|
@@ -147,7 +149,7 @@ class Dut(_InjectMixinCls):
|
|
|
147
149
|
"""
|
|
148
150
|
Expect a unity test summary block and parse the output into junit report.
|
|
149
151
|
|
|
150
|
-
Would combine the junit report into the main one if you use
|
|
152
|
+
Would combine the junit report into the main one if you use ``pytest --junitxml`` feature.
|
|
151
153
|
|
|
152
154
|
Args:
|
|
153
155
|
remove_asci_escape_code: remove asci escape code in the message field. (default: True)
|
|
@@ -155,10 +157,10 @@ class Dut(_InjectMixinCls):
|
|
|
155
157
|
extra_before: would append before the expected bytes.
|
|
156
158
|
Use this argument when need to run `expect` functions between one unity test call.
|
|
157
159
|
|
|
158
|
-
|
|
160
|
+
Note:
|
|
159
161
|
- Would raise AssertionError at the end of the test if any unity test case result is "FAIL"
|
|
160
|
-
- Would raise TIMEOUT exception at the end of the test
|
|
161
|
-
than timeout value
|
|
162
|
+
- Would raise TIMEOUT exception at the end of the test \
|
|
163
|
+
if any unity test case execution took longer than timeout value
|
|
162
164
|
|
|
163
165
|
Warning:
|
|
164
166
|
- All unity test cases record would be missed if the final report block is uncaught.
|
|
@@ -182,7 +184,7 @@ class Dut(_InjectMixinCls):
|
|
|
182
184
|
reset: bool = False,
|
|
183
185
|
timeout: float = 30,
|
|
184
186
|
run_ignore_cases: bool = False,
|
|
185
|
-
):
|
|
187
|
+
) -> None:
|
|
186
188
|
"""
|
|
187
189
|
Run all multi_stage cases
|
|
188
190
|
|
|
@@ -193,6 +195,6 @@ class Dut(_InjectMixinCls):
|
|
|
193
195
|
run_ignore_cases: run ignored test cases or not
|
|
194
196
|
|
|
195
197
|
Warning:
|
|
196
|
-
requires enable service
|
|
198
|
+
requires enable service ``idf``
|
|
197
199
|
"""
|
|
198
200
|
pass
|
|
@@ -55,17 +55,15 @@ class PexpectProcess(pexpect.fdpexpect.fdspawn):
|
|
|
55
55
|
placeholder=f'... (total {len(self.buffer)} bytes)',
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
def read_nonblocking(self, size=1, timeout
|
|
58
|
+
def read_nonblocking(self, size: int = 1, timeout: int = -1) -> bytes:
|
|
59
59
|
"""
|
|
60
60
|
Since we're using real file stream, here we only raise an EOF error when the file stream has been closed.
|
|
61
61
|
This could solve the `os.read()` blocked issue.
|
|
62
62
|
|
|
63
|
-
:return: String containing the bytes read
|
|
64
|
-
|
|
65
63
|
Args:
|
|
66
|
-
size
|
|
67
|
-
timeout
|
|
68
|
-
ready to read. When -1 (default), use self.timeout
|
|
64
|
+
size: Read at most *size* bytes.
|
|
65
|
+
timeout: Wait timeout seconds for file descriptor to be
|
|
66
|
+
ready to read. When -1 (default), use `self.timeout`. When 0, poll.
|
|
69
67
|
|
|
70
68
|
Returns:
|
|
71
69
|
String containing the bytes read
|
|
@@ -115,7 +113,7 @@ def live_print_call(*args, msg_queue: Optional[MessageQueue] = None, expect_retu
|
|
|
115
113
|
msg_queue: `MessageQueue` instance, would redirect to message queue instead of sys.stdout if specified
|
|
116
114
|
expect_returncode: expect return code. (Default 0). Would raise exception when return code is different
|
|
117
115
|
|
|
118
|
-
|
|
116
|
+
Note:
|
|
119
117
|
This function behaves the same as `subprocess.call()`, it would block your current process.
|
|
120
118
|
"""
|
|
121
119
|
default_kwargs = {
|
|
@@ -210,12 +208,11 @@ class DuplicateStdoutPopen(subprocess.Popen):
|
|
|
210
208
|
super().terminate()
|
|
211
209
|
|
|
212
210
|
def write(self, s: AnyStr) -> None:
|
|
213
|
-
"""
|
|
211
|
+
r"""
|
|
214
212
|
Write to `stdin` via `stdin.write`.
|
|
215
213
|
|
|
216
|
-
If the input is `str`, will encode to `bytes` and add a b'\\n' automatically in the end.
|
|
217
|
-
|
|
218
|
-
if the input is `bytes`, will pass this directly.
|
|
214
|
+
- If the input is `str`, will encode to `bytes` and add a b'\\n' automatically in the end.
|
|
215
|
+
- If the input is `bytes`, will pass this directly.
|
|
219
216
|
|
|
220
217
|
Args:
|
|
221
218
|
s: bytes or str
|
|
@@ -341,7 +341,7 @@ def multi_dut_fixture(func) -> t.Callable[..., t.Union[t.Any, t.Tuple[t.Any]]]:
|
|
|
341
341
|
"""
|
|
342
342
|
Apply the multi-dut arguments to each fixture.
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
Note:
|
|
345
345
|
Run the `func(*args, **kwargs)` for multiple times by iterating all `kwargs` via `itemgetter`
|
|
346
346
|
|
|
347
347
|
For example:
|
|
@@ -387,7 +387,7 @@ def multi_dut_generator_fixture(
|
|
|
387
387
|
"""
|
|
388
388
|
Apply the multi-dut arguments to each fixture.
|
|
389
389
|
|
|
390
|
-
|
|
390
|
+
Note:
|
|
391
391
|
Run the `func()` for multiple times by iterating all `kwargs` via `itemgetter`. Auto call `close()` or
|
|
392
392
|
`terminate()` method of the object after it yield back.
|
|
393
393
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dataclasses
|
|
2
|
+
import functools
|
|
2
3
|
import importlib
|
|
3
4
|
import logging
|
|
4
5
|
import os
|
|
@@ -117,10 +118,11 @@ def to_list(s: _T) -> t.List[_T]:
|
|
|
117
118
|
s: Anything
|
|
118
119
|
|
|
119
120
|
Returns:
|
|
120
|
-
List (list[_T])
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
List (list[_T])
|
|
122
|
+
|
|
123
|
+
- `list(s)` (List. If `s` is a tuple or a set.
|
|
124
|
+
- itself. If `s` is a list.
|
|
125
|
+
- `[s]`. If `s` is other types.
|
|
124
126
|
"""
|
|
125
127
|
if not s:
|
|
126
128
|
return s
|
|
@@ -231,22 +233,23 @@ def lazy_load(
|
|
|
231
233
|
Returns:
|
|
232
234
|
__getattr__ function
|
|
233
235
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
236
|
+
Example:
|
|
237
|
+
|
|
238
|
+
::
|
|
239
|
+
|
|
240
|
+
__getattr__ = lazy_load(
|
|
241
|
+
importlib.import_module(__name__),
|
|
242
|
+
{
|
|
243
|
+
'IdfApp': IdfApp,
|
|
244
|
+
'LinuxDut': LinuxDut,
|
|
245
|
+
'LinuxSerial': LinuxSerial,
|
|
246
|
+
'CaseTester': CaseTester,
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
'IdfSerial': '.serial',
|
|
250
|
+
'IdfDut': '.dut',
|
|
251
|
+
},
|
|
252
|
+
)
|
|
250
253
|
"""
|
|
251
254
|
|
|
252
255
|
def __getattr__(object_name):
|
|
@@ -294,33 +297,36 @@ class _InjectMixinCls(metaclass=_InjectMixinMeta):
|
|
|
294
297
|
- provide the autocompletion for the functions provided by the mixins
|
|
295
298
|
- check the requirement at runtime
|
|
296
299
|
|
|
297
|
-
|
|
300
|
+
Example:
|
|
301
|
+
|
|
302
|
+
::
|
|
298
303
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
class IdfUnityMixin:
|
|
305
|
+
def foo(self):
|
|
306
|
+
print('foo from MixinOne')
|
|
302
307
|
|
|
303
308
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
309
|
+
class Test(_InjectMixinCls):
|
|
310
|
+
def __init__(self, **kwargs):
|
|
311
|
+
for k, v in kwargs.items():
|
|
312
|
+
setattr(self, k, v)
|
|
308
313
|
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
314
|
+
@_InjectMixinCls.require_services('idf')
|
|
315
|
+
def foo(self):
|
|
316
|
+
pass
|
|
312
317
|
|
|
313
318
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
# mro(): TestWithIdfUnityMixin, IdfUnityMixin, Test, object
|
|
320
|
+
s1 = Test(mixins=IdfUnityMixin)
|
|
321
|
+
# mro(): Test, object
|
|
322
|
+
s2 = Test()
|
|
323
|
+
s1.foo() # foo from IdfUnityMixin
|
|
324
|
+
s2.foo() # function foo requires enabling one of the service(s) idf.
|
|
320
325
|
"""
|
|
321
326
|
|
|
322
327
|
def require_services(*services):
|
|
323
328
|
def decorator(func):
|
|
329
|
+
@functools.wraps(func)
|
|
324
330
|
def wrapped(self, *args, **kwargs):
|
|
325
331
|
based = False
|
|
326
332
|
for service in services:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: pytest-embedded
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.1
|
|
4
4
|
Summary: pytest embedded plugin
|
|
5
5
|
Home-page: https://docs.espressif.com/projects/pytest-embedded/en/latest/
|
|
6
6
|
Author: Fu Hanxi
|
|
@@ -10,10 +10,6 @@ Description: ### pytest-embedded
|
|
|
10
10
|
|
|
11
11
|
A pytest plugin for embedded systems. Could activate different services for extra functionalities.
|
|
12
12
|
|
|
13
|
-
Used CLI Options:
|
|
14
|
-
|
|
15
|
-
- `app_path`
|
|
16
|
-
|
|
17
13
|
Platform: UNKNOWN
|
|
18
14
|
Classifier: Framework :: Pytest
|
|
19
15
|
Classifier: Intended Audience :: Developers
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pytest-embedded-1.3.0 → pytest-embedded-1.3.1}/pytest_embedded.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|