emintes-testframework 0.1.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,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: emintes-testframework
3
+ Version: 0.1.0
4
+ Summary: Autogenerated host-side stubs for the CHECKBOX testframework API
5
+ Requires-Python: >=3.10
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "emintes-testframework"
7
+ version = "0.1.0"
8
+ description = "Autogenerated host-side stubs for the CHECKBOX testframework API"
9
+ requires-python = ">=3.10"
10
+
11
+ [tool.setuptools]
12
+ package-dir = {"" = "src"}
13
+
14
+ [tool.setuptools.package-data]
15
+ testframework = ["py.typed"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ Metadata-Version: 2.4
2
+ Name: emintes-testframework
3
+ Version: 0.1.0
4
+ Summary: Autogenerated host-side stubs for the CHECKBOX testframework API
5
+ Requires-Python: >=3.10
@@ -0,0 +1,8 @@
1
+ pyproject.toml
2
+ src/emintes_testframework.egg-info/PKG-INFO
3
+ src/emintes_testframework.egg-info/SOURCES.txt
4
+ src/emintes_testframework.egg-info/dependency_links.txt
5
+ src/emintes_testframework.egg-info/top_level.txt
6
+ src/testframework/__init__.py
7
+ src/testframework/py.typed
8
+ src/testframework/testreport.py
@@ -0,0 +1,808 @@
1
+ """Autogenerated host-side stubs for the CHECKBOX testframework API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from .testreport import report
8
+
9
+ _RUNTIME_MESSAGE = "This package only provides autogenerated host-side stubs for the CHECKBOX MicroPython API."
10
+
11
+ LOW: int = 0
12
+ HIGH: int = 1
13
+ RISING: int = 1
14
+ FALLING: int = 2
15
+ LEVEL_3V3: int = 0
16
+ LEVEL_5V: int = 1
17
+ REL1: int = 1
18
+ REL2: int = 2
19
+ AOUT1: int = 1
20
+ AOUT2: int = 2
21
+ AIN1: int = 1
22
+ AIN2: int = 2
23
+ AIN3: int = 3
24
+ AIN4: int = 4
25
+ AIN5: int = 5
26
+ AIN6: int = 6
27
+ AIN7: int = 7
28
+ AIN8: int = 8
29
+ OUT1: int = 1
30
+ OUT2: int = 2
31
+ OUT3: int = 3
32
+ OUT4: int = 4
33
+ OUT5: int = 5
34
+ OUT6: int = 6
35
+ OUT7: int = 7
36
+ OUT8: int = 8
37
+ OUT9: int = 9
38
+ OUT10: int = 10
39
+ OUT11: int = 11
40
+ OUT12: int = 12
41
+ IN1: int = 1
42
+ IN2: int = 2
43
+ IN3: int = 3
44
+ IN4: int = 4
45
+ IN5: int = 5
46
+ IN6: int = 6
47
+ IN7: int = 7
48
+ IN8: int = 8
49
+ IN9: int = 9
50
+ IN10: int = 10
51
+ IN11: int = 11
52
+ IN12: int = 12
53
+
54
+ class PWMResult:
55
+ """Autogenerated placeholder for PWMResult."""
56
+ period: Any
57
+ onTime: Any
58
+ frequency: Any
59
+ dutyCycle: Any
60
+
61
+ def __init__(self, period, onTime, frequency, dutyCycle):
62
+ """Autogenerated stub for PWMResult.__init__."""
63
+ self.period = period
64
+ self.onTime = onTime
65
+ self.frequency = frequency
66
+ self.dutyCycle = dutyCycle
67
+
68
+ def print(self):
69
+ """Autogenerated stub for PWMResult.print."""
70
+ raise NotImplementedError(_RUNTIME_MESSAGE)
71
+
72
+
73
+ def setTestframeworkCoreReference(ref):
74
+ """Autogenerated stub for setTestframeworkCoreReference. The runtime implementation is only available on the CHECKBOX device."""
75
+ raise NotImplementedError(_RUNTIME_MESSAGE)
76
+
77
+
78
+ def prepareTest():
79
+ """Autogenerated stub for prepareTest. The runtime implementation is only available on the CHECKBOX device."""
80
+ raise NotImplementedError(_RUNTIME_MESSAGE)
81
+
82
+
83
+ def backToDefaults():
84
+ """Autogenerated stub for backToDefaults. The runtime implementation is only available on the CHECKBOX device."""
85
+ raise NotImplementedError(_RUNTIME_MESSAGE)
86
+
87
+
88
+ def abortTest(msg: str):
89
+ """
90
+ This function aborts the running test.
91
+
92
+ :param msg: This message is displayed as the reason for cancellation in the test report.
93
+ :type msg: str
94
+ """
95
+ raise NotImplementedError(_RUNTIME_MESSAGE)
96
+
97
+
98
+ def abortTestOnFailure(abort: bool):
99
+ """
100
+ Setup the behavior of the test if a test failed. The default value is ``False``.
101
+
102
+ :param abort: Set this to ``True`` to stop the test on failed result. ``False`` means that the test will continue when a step failed.
103
+ :type abort: bool
104
+
105
+ **Example usage:**
106
+
107
+ .. highlight:: python
108
+ .. code-block:: python
109
+
110
+ from testframework import *
111
+
112
+ report.abortTestOnFailure(True)
113
+
114
+ .. note::
115
+ You can change the behavior during test as often as you want.
116
+ If you have a sequence in which an error should lead to the test being stopped immediately,
117
+ you can activate this option at the start of the sequence and deactivate it at the end.
118
+ """
119
+ raise NotImplementedError(_RUNTIME_MESSAGE)
120
+
121
+
122
+ def keepConfigurationAfterTest(keepConfig: bool):
123
+ """
124
+ After each test run, the framework resets the test box to default configuration (I/O Supply disabled, External Supply Relais disabled, ...).
125
+ If you want to debug the firmware of the DUT, this can lead to problems.
126
+ You can therefore manually activate/deactivate the reset to default values via this function call.
127
+
128
+ The setting is retained until the box is restarted.
129
+
130
+ :param keepConfig: Set this to ``True`` and all configuration will be kept after Test. ``False`` (default value) will reset configuration after Test.
131
+ :type keepConfig: bool
132
+
133
+ **Example usage:**
134
+
135
+ .. highlight:: python
136
+ .. code-block:: python
137
+
138
+ from testframework import *
139
+
140
+ keepConfigurationAfterTest(True)
141
+ """
142
+ raise NotImplementedError(_RUNTIME_MESSAGE)
143
+
144
+
145
+ def enableIOSupply(level):
146
+ """
147
+ Activates the power supply for the IO-Pins.
148
+ You can choose which voltage level is used.
149
+
150
+ :param level: LEVEL_3V3, or LEVEL_5V
151
+
152
+ **Example usage:**
153
+
154
+ .. highlight:: python
155
+ .. code-block:: python
156
+
157
+ from testframework import *
158
+
159
+ enableIOSupply(LEVEL_3V3)
160
+ """
161
+ raise NotImplementedError(_RUNTIME_MESSAGE)
162
+
163
+
164
+ def disableIOSupply():
165
+ """
166
+ Disables the power supply for the IO-Pins.
167
+
168
+ **Example usage:**
169
+
170
+ .. highlight:: python
171
+ .. code-block:: python
172
+
173
+ from testframework import *
174
+
175
+ disableIOSupply()
176
+ """
177
+ raise NotImplementedError(_RUNTIME_MESSAGE)
178
+
179
+
180
+ def enableExternalSupply():
181
+ """Autogenerated stub for enableExternalSupply. The runtime implementation is only available on the CHECKBOX device."""
182
+ raise NotImplementedError(_RUNTIME_MESSAGE)
183
+
184
+
185
+ def disableExternalSupply():
186
+ """Autogenerated stub for disableExternalSupply. The runtime implementation is only available on the CHECKBOX device."""
187
+ raise NotImplementedError(_RUNTIME_MESSAGE)
188
+
189
+
190
+ def enableDUTSupply():
191
+ """Autogenerated stub for enableDUTSupply. The runtime implementation is only available on the CHECKBOX device."""
192
+ raise NotImplementedError(_RUNTIME_MESSAGE)
193
+
194
+
195
+ def disableDUTSupply():
196
+ """Autogenerated stub for disableDUTSupply. The runtime implementation is only available on the CHECKBOX device."""
197
+ raise NotImplementedError(_RUNTIME_MESSAGE)
198
+
199
+
200
+ def enableRelais():
201
+ """
202
+ Sets the Relaisoutput.
203
+
204
+ Example usage:
205
+
206
+ .. highlight:: python
207
+ .. code-block:: python
208
+
209
+ from testframework import *
210
+
211
+ enableRelais()
212
+ """
213
+ raise NotImplementedError(_RUNTIME_MESSAGE)
214
+
215
+
216
+ def disableRelais():
217
+ """
218
+ Unset the Relaisoutput.
219
+
220
+ Example usage:
221
+
222
+ .. highlight:: python
223
+ .. code-block:: python
224
+
225
+ from testframework import *
226
+
227
+ disableRelais()
228
+ """
229
+ raise NotImplementedError(_RUNTIME_MESSAGE)
230
+
231
+
232
+ def getInputVoltage(input):
233
+ """
234
+ Measures and returns the voltage at an analog input pin.
235
+
236
+ :param input: Number of the analog input pin. You can use the constants (AIN1, AIN2, ..., AIN8) or integer numbers (1-8)
237
+ :type input: int
238
+ :returns: Measured voltage in unit Volt
239
+ :rtype: float
240
+
241
+ Example usage:
242
+
243
+ .. highlight:: python
244
+ .. code-block:: python
245
+
246
+ from testframework import *
247
+
248
+ voltage = getInputVoltage(AIN1)
249
+ print(voltage)
250
+ """
251
+ raise NotImplementedError(_RUNTIME_MESSAGE)
252
+
253
+
254
+ def setOutputVoltage(output, voltage: float):
255
+ """
256
+ Sets the output voltage of an analog output pin.
257
+
258
+ :param output: Analog output pin. You can use the constants (AOUT1, AOUT2) or integer numbers (1-2)
259
+ :type output: int
260
+ :param voltage: Voltage in Volt
261
+ :type voltage: float
262
+
263
+ .. note::
264
+ You have to enable the IO-Supply with function ``enableIOSupply`` first.
265
+ Keep in mind, that the maximum output voltage for the analog output is limited by the voltage level you have choosen.
266
+
267
+ **Example usage:**
268
+
269
+ Sets the AOUT1 pin to 2,8V:
270
+
271
+ .. highlight:: python
272
+ .. code-block:: python
273
+
274
+ from testframework import *
275
+
276
+ enableIOSupply(LEVEL_3V3)
277
+ setOutputVoltage(AOUT1, 2.8)
278
+ """
279
+ raise NotImplementedError(_RUNTIME_MESSAGE)
280
+
281
+
282
+ def getInputs():
283
+ """
284
+ Returns the state of all digital inputs.
285
+
286
+ :returns: array of 12 elements with following values: 0 if the corresponding input is low, 1 if the corresponding input is high
287
+
288
+ **Example usage:**
289
+
290
+ .. highlight:: python
291
+ .. code-block:: python
292
+
293
+ from testframework import *
294
+
295
+ inputStates = getInputs()
296
+ if inputStates[0] == HIGH and inputStates[7] == LOW:
297
+ print("Pin 1 is high and pin 8 is low")
298
+ else:
299
+ print("wrong pin levels")
300
+ """
301
+ raise NotImplementedError(_RUNTIME_MESSAGE)
302
+
303
+
304
+ def isInputHigh(input):
305
+ """
306
+ Checks if the geiven input has a hihg-level.
307
+
308
+ :param input: Digital intput pin. You can use the constants (IN1, IN2, ... , IN12) or integer numbers (1-12)
309
+ :type input: int
310
+ :returns: ``True`` if the pin is high. ``False`` if the pin is low.
311
+
312
+ **Example usage:**
313
+
314
+ .. highlight:: python
315
+ .. code-block:: python
316
+
317
+ from testframework import *
318
+
319
+ if isInputHigh(IN9):
320
+ print("Pin is high")
321
+ else:
322
+ print("Pin is low")
323
+ """
324
+ raise NotImplementedError(_RUNTIME_MESSAGE)
325
+
326
+
327
+ def isInputLow(input: int):
328
+ """See :func:`~testframework.isInputHigh`"""
329
+ raise NotImplementedError(_RUNTIME_MESSAGE)
330
+
331
+
332
+ def getInput(input: int):
333
+ """
334
+ Returns the state of a digital input.
335
+
336
+ :param input: Digital intput pin. You can use the constants (IN1, IN2, ... , IN12) or integer numbers (1-12)
337
+ :type input: int
338
+ :returns: 0 if input is low, 1 if input is high (you can use constants ``LOW`` or ``HIGH`` to check the value), -1 on error
339
+
340
+ **Example usage:**
341
+
342
+ .. highlight:: python
343
+ .. code-block:: python
344
+
345
+ from testframework import *
346
+
347
+ if getInput(IN9) == HIGH:
348
+ print("Pin is high")
349
+ else:
350
+ print("Pin is low")
351
+ """
352
+ raise NotImplementedError(_RUNTIME_MESSAGE)
353
+
354
+
355
+ async def waitForLow(input: int, timeout: int | str):
356
+ """
357
+ Waits until a given digital input pin is low.
358
+
359
+ For the timeout parameter you have two options:
360
+
361
+ * Set a timeout in milliseconds. When reaching this timeout before the input gets low, this function returns False
362
+ * If you are waiting for an user-action at this point, you can give an usermessage as string which will be displayed on the screen (e.g.: user has to press a button on the DUT and the test wants to read the low level value). The user can abort this action by pressing the red button on the box. In this case, the function will return False.
363
+
364
+
365
+ :param input: Digital intput pin. You can use the constants (IN1, IN2, ... , IN12) or integer numbers (1-12)
366
+ :type input: int
367
+ :param timeout: Timeout in milliseconds or a string with a user message. If the user message is given, the user can abort the action by pressing the red button on the box.
368
+ :type timeout: int or str
369
+ :returns: ``True`` if the pin got low within given timeout. ``False`` if the timeout has expired or the user aborted with red button.
370
+
371
+ .. warning::
372
+ this is an async function. You have to call it with ``await``.
373
+
374
+ **Example usage:**
375
+
376
+ To wait for low level of digital input pin 5 with a timeout of 2 seconds:
377
+
378
+ .. highlight:: python
379
+ .. code-block:: python
380
+
381
+ from testframework import *
382
+
383
+ result = await waitForLow(IN5, 2000)
384
+ if result == True:
385
+ print("Pin is now low")
386
+ else:
387
+ print("Timeout")
388
+
389
+
390
+ The User should press a button on the DUT to test if the signals on the DUT are working correctly.
391
+
392
+ .. highlight:: python
393
+ .. code-block:: python
394
+
395
+ from testframework import *
396
+
397
+ result = await waitForLow(IN5, "Press push button 1 on DUT")
398
+ report.checkBool("push button 1 signal OK")
399
+ """
400
+ raise NotImplementedError(_RUNTIME_MESSAGE)
401
+
402
+
403
+ async def waitForHigh(input: int, timeout: int | str):
404
+ """See :func:`~testframework.waitForLow`"""
405
+ raise NotImplementedError(_RUNTIME_MESSAGE)
406
+
407
+
408
+ def setOutputLow(output: int):
409
+ """
410
+ Sets the Output to Low level (0V)
411
+
412
+ :param output: Digital output pin. You can use the constants (OUT1, OUT2, ... , OUT12) or integer numbers (1-12)
413
+ :type input: int
414
+
415
+ **Example usage:**
416
+
417
+ .. highlight:: python
418
+ .. code-block:: python
419
+
420
+ from testframework import *
421
+
422
+ enableIOSupply(LEVEL_5V)
423
+ setOutputLow(OUT3)
424
+ """
425
+ raise NotImplementedError(_RUNTIME_MESSAGE)
426
+
427
+
428
+ def setOutputHigh(output):
429
+ """
430
+ Sets the Output to High level. The voltage of high level is defined by the ``enableIOSupply`` call.
431
+
432
+ :param output: Digital output pin. You can use the constants (OUT1, OUT2, ... , OUT12) or integer numbers (1-12)
433
+ :type input: int
434
+
435
+ **Example usage:**
436
+
437
+ .. highlight:: python
438
+ .. code-block:: python
439
+
440
+ from testframework import *
441
+
442
+ enableIOSupply(LEVEL_3V3)
443
+ setOutputHigh(OUT3)
444
+ """
445
+ raise NotImplementedError(_RUNTIME_MESSAGE)
446
+
447
+
448
+ def setOutputPWM(output: int, dutyCycle: float, frequency: int = -1):
449
+ """
450
+ Outputs a PWM signal at the given Output Pin. The high-voltage level of the signal is defined by the ``enableIOSupply`` call.
451
+
452
+ .. warning::
453
+ OUT1, OUT2 and OUT3 uses the same Timer. So all three PWM outputs always have the same frequency! Changing the frequency of one also changes frequency of the other.
454
+
455
+ The same behavior also applies to OUT4 and OUT5. They also use the same timer (but they are completely independent to OUT1/OUT2/OUT3).
456
+
457
+ :param output: Digital output pin which can generate a PWM signal. Allowed: OUT1, OUT2, OUT3, OUT4, OUT5.
458
+ :type input: int
459
+ :param dutyCycle: duty cycle of the PWM signal in percent (0-100)
460
+ :type dutyCycle: float
461
+ :param frequency: (optional) defines the frequency of the signal in Hz. If this parameter is omitted, the signal will keep the last set frequency. On first call the frequency will set to 1kHz.
462
+ :type frequency: int
463
+
464
+ **Example usage:**
465
+
466
+ Outputs a 5kHz PWM Signal with 25% duty cycle at Pin OUT1.
467
+
468
+ .. highlight:: python
469
+ .. code-block:: python
470
+
471
+ from testframework import *
472
+
473
+ enableIOSupply(LEVEL_5V)
474
+ setOutputPWM(OUT1, 25.0, 5000)
475
+ """
476
+ raise NotImplementedError(_RUNTIME_MESSAGE)
477
+
478
+
479
+ def getDeviceTemperature():
480
+ """
481
+ Returns the current internal temperature of the Checkbox.
482
+
483
+ :returns: Temperature in °C
484
+ :return type: float
485
+
486
+ **Example usage:**
487
+
488
+ .. highlight:: python
489
+ .. code-block:: python
490
+
491
+ from testframework import *
492
+
493
+ devTemp = getDeviceTemperature()
494
+ report.infoValue("Device temperature", "%.1f °C" %devTemp)
495
+ """
496
+ raise NotImplementedError(_RUNTIME_MESSAGE)
497
+
498
+
499
+ async def sleep_ms(x):
500
+ """Autogenerated stub for sleep_ms. The runtime implementation is only available on the CHECKBOX device."""
501
+ raise NotImplementedError(_RUNTIME_MESSAGE)
502
+
503
+
504
+ async def sleep(x):
505
+ """Autogenerated stub for sleep. The runtime implementation is only available on the CHECKBOX device."""
506
+ raise NotImplementedError(_RUNTIME_MESSAGE)
507
+
508
+
509
+ def getSerialNumber():
510
+ """Autogenerated stub for getSerialNumber. The runtime implementation is only available on the CHECKBOX device."""
511
+ raise NotImplementedError(_RUNTIME_MESSAGE)
512
+
513
+
514
+ def getHWVersion():
515
+ """Autogenerated stub for getHWVersion. The runtime implementation is only available on the CHECKBOX device."""
516
+ raise NotImplementedError(_RUNTIME_MESSAGE)
517
+
518
+
519
+ def getSWVersion():
520
+ """Autogenerated stub for getSWVersion. The runtime implementation is only available on the CHECKBOX device."""
521
+ raise NotImplementedError(_RUNTIME_MESSAGE)
522
+
523
+
524
+ async def getFrequency(input, timeout_ms):
525
+ """Autogenerated stub for getFrequency. The runtime implementation is only available on the CHECKBOX device."""
526
+ raise NotImplementedError(_RUNTIME_MESSAGE)
527
+
528
+
529
+ def getCurrent():
530
+ """Autogenerated stub for getCurrent. The runtime implementation is only available on the CHECKBOX device."""
531
+ raise NotImplementedError(_RUNTIME_MESSAGE)
532
+
533
+
534
+ def convertADCToCurrent(adcValue, refVoltage):
535
+ """Autogenerated stub for convertADCToCurrent. The runtime implementation is only available on the CHECKBOX device."""
536
+ raise NotImplementedError(_RUNTIME_MESSAGE)
537
+
538
+
539
+ async def getUserInputBool(message: str) -> bool:
540
+ """
541
+ Shows an user input dialog where the user can answer a simple Yes/No question.
542
+
543
+ :param message: Message that will be displayed
544
+ :type message: string
545
+ :returns: user input
546
+ :return type: bool
547
+
548
+ **Example usage:**
549
+
550
+ .. highlight:: python
551
+ .. code-block:: python
552
+
553
+ from testframework import *
554
+
555
+ answer = await getUserInputBool("Is the green LED on?")
556
+ report.checkBool("Green LED on", answer)
557
+ """
558
+ raise NotImplementedError(_RUNTIME_MESSAGE)
559
+
560
+
561
+ async def getUserInputString(message: str) -> str:
562
+ """
563
+ Shows an user input dialog where the user can enter Text.
564
+
565
+ :param message: Message that will be displayed
566
+ :type message: string
567
+ :returns: user input
568
+ :return type: string
569
+
570
+ **Example usage:**
571
+
572
+ .. highlight:: python
573
+ .. code-block:: python
574
+
575
+ from testframework import *
576
+
577
+ answer = await getUserInputString("Enter Serial Number")
578
+ if len(answer) == 8:
579
+ serialNumber = answer
580
+ else:
581
+ report.checkValue("Entered Serialnumber has wrong length.", len(answer), 8)
582
+ """
583
+ raise NotImplementedError(_RUNTIME_MESSAGE)
584
+
585
+
586
+ async def getUserInputInt(message: str) -> str:
587
+ """
588
+ Shows an user input dialog where the user can enter an Integer Number.
589
+
590
+ :param message: Message that will be displayed
591
+ :type message: string
592
+ :returns: user input
593
+ :return type: string
594
+
595
+ **Example usage:**
596
+
597
+ .. highlight:: python
598
+ .. code-block:: python
599
+
600
+ from testframework import *
601
+
602
+ answer = await getUserInputInt("Enter your personal number")
603
+ report.putInfoValue("Personal Number of tester", answer)
604
+ """
605
+ raise NotImplementedError(_RUNTIME_MESSAGE)
606
+
607
+
608
+ async def getUserInputFloat(message: str) -> str:
609
+ """
610
+ Shows an user input dialog where the user can enter an Floatingpoint Number.
611
+
612
+ :param message: Message that will be displayed
613
+ :type message: string
614
+ :returns: user input
615
+ :return type: string
616
+
617
+ **Example usage:**
618
+
619
+ .. highlight:: python
620
+ .. code-block:: python
621
+
622
+ from testframework import *
623
+
624
+ answer = await getUserInputFloat("Enter current exchange rate")
625
+ report.putInfoValue("Exchange Rate", answer)
626
+ """
627
+ raise NotImplementedError(_RUNTIME_MESSAGE)
628
+
629
+
630
+ async def getUserInputSerialNumber(message: str, usb = True, pc = True, display = True) -> str:
631
+ """
632
+ Prompts the user to enter the serial number.
633
+ The serial number can be entered on the PC, via the display, or using a barcode scanner.
634
+
635
+ :param message: Message that will be displayed
636
+ :type message: string
637
+ :param usb: If an USB-Module is connected, any input from the USB device will be accepted.
638
+ :type usb: bool
639
+ :param pc: a message on PC will be displayed on PC and the user can input the serial number on the PC. Set to ´´False´´ if you dont want a Message on PC side.
640
+ :type pc: bool
641
+ :param display: if this parameter is true, a keyboard ist displayed on the display and the user can enter the serial number there. Set to ´´False´´ if you just want to get a simple user message on the display.
642
+ :type display: bool
643
+ :returns: user input
644
+ :return type: string
645
+
646
+ **Example usage:**
647
+
648
+ .. highlight:: python
649
+ .. code-block:: python
650
+
651
+ from testframework import *
652
+
653
+ serialNumber = await getUserInputSerialNumber("Enter Serial Number")
654
+ report.putInfoValue("DUT Serial Number", serialNumber)
655
+ """
656
+ raise NotImplementedError(_RUNTIME_MESSAGE)
657
+
658
+
659
+ async def showUserMessage(message: str):
660
+ """
661
+ Shows an user info-message which can be acknowledged by pressing OK.
662
+
663
+ :param message: Message that will be displayed
664
+ :type message: string
665
+ :returns: nothing
666
+
667
+ **Example usage:**
668
+
669
+ .. highlight:: python
670
+ .. code-block:: python
671
+
672
+ from testframework import *
673
+
674
+ await showUserMessage("Solder the cable now:\nPad P1: Black wire\nPad P2: Brown wire\nPad P3: Red Wire")
675
+ """
676
+ raise NotImplementedError(_RUNTIME_MESSAGE)
677
+
678
+
679
+ def showProgressBar(description: str):
680
+ """
681
+ Shows a progress bar on the PC. This can be used to show the user a progress if a step during the test needs some time.
682
+
683
+ :param description: Text which will be displayed
684
+ :type description: string
685
+
686
+ **Example usage:**
687
+
688
+ .. highlight:: python
689
+ .. code-block:: python
690
+
691
+ from testframework import *
692
+
693
+ showProgressBar("Download Firmware")
694
+ for i in range(10):
695
+ updateProgressBar(i*10)
696
+ await sleep_ms(300)
697
+ hideProgressBar()
698
+ """
699
+ raise NotImplementedError(_RUNTIME_MESSAGE)
700
+
701
+
702
+ def updateProgressBar(progress: float):
703
+ """
704
+ Sets the progress bar to given value. The progress value is in percent and have to be between 0-100%.
705
+
706
+ :param progress: Progress which should be set.
707
+ :type progress: float
708
+
709
+ **Example usage:**
710
+
711
+ .. highlight:: python
712
+ .. code-block:: python
713
+
714
+ from testframework import *
715
+
716
+ showProgressBar("Download Firmware")
717
+ for i in range(10):
718
+ updateProgressBar(i*10)
719
+ await sleep_ms(300)
720
+ hideProgressBar()
721
+ """
722
+ raise NotImplementedError(_RUNTIME_MESSAGE)
723
+
724
+
725
+ def hideProgressBar():
726
+ """
727
+ Hides the progress bar on PC and display.
728
+
729
+ **Example usage:**
730
+
731
+ .. highlight:: python
732
+ .. code-block:: python
733
+
734
+ from testframework import *
735
+
736
+ showProgressBar("Download Firmware")
737
+ for i in range(10):
738
+ updateProgressBar(i*10)
739
+ await sleep_ms(300)
740
+ hideProgressBar()
741
+ """
742
+ raise NotImplementedError(_RUNTIME_MESSAGE)
743
+
744
+
745
+ async def executeCommand(cmdNumber: int, argument: str = '') -> int:
746
+ """
747
+ Executes a command defined in the project settings on the connected computer.
748
+ This can be used, for example, to download firmware to the device or to execute specific programmes on the PC that are required for the test.
749
+ See also chapter :doc:`flashFirmware`.
750
+
751
+ :param cmdNumber: selects which command from project settings should be executed.
752
+ :type cmdNumber: int
753
+ :param argument: (optional) Sets the argument values for the command.
754
+ :type argument: str
755
+
756
+
757
+ :returns: The code returned by the command after its execution.
758
+ :return type: int
759
+
760
+ **Example usage:**
761
+
762
+ .. highlight:: python
763
+ .. code-block:: python
764
+
765
+ from testframework import *
766
+
767
+ abortTestOnFailure(True)
768
+ enableDUTSupply()
769
+ await sleep(1.5)
770
+ res = await executeCommand(1)
771
+ report.checkBool("Download Firmware to the Device", res==0)
772
+ """
773
+ raise NotImplementedError(_RUNTIME_MESSAGE)
774
+
775
+
776
+ async def getPwm(input: int, timeout: int) -> PWMResult:
777
+ """
778
+ Measures a PWM Signal on Pin IN7. Returns a ``PWMResult`` Object, which contains the ``frequency``, ``period``, ``onTime``, ``dutyCycle``
779
+
780
+ :param input: Digital intput pin. Only IN7 can be used at the moment.
781
+ :type input: int
782
+ :param timeout: Timeout in milliseconds. The function will always record over the full timeout-Time. After timeout it will return. If there was no edges detected - you will get a dutyCycle of 100% or 0%, depending if the signal level was high or low.
783
+ :type timeout: int
784
+
785
+ :returns: None on error. Otherwise a PWMResult object, containing measured ``frequency``, ``period``, ``onTime``, ``dutyCycle``
786
+ :return type: PWMResult or None
787
+
788
+ **Example usage:**
789
+
790
+ .. highlight:: python
791
+ .. code-block:: python
792
+
793
+ from testframework import *
794
+
795
+ enableIOSupply(LEVEL_3V3)
796
+ pwmResult = await getPwm(IN7, 100)
797
+ report.checkValueTollerance("Check Frequency", pwmResult.frequency, 50.0, 0.2, "Hz", 1)
798
+ report.checkValueTollerance("Check On-Time", pwmResult.onTime, 1.5, 0.2, "ms", 1)
799
+ report.checkValueTollerance("Check duty cycle", pwmResult.dutyCycle, 7.5, 0.2, "%", 1)
800
+ """
801
+ raise NotImplementedError(_RUNTIME_MESSAGE)
802
+
803
+
804
+ def doCalibration():
805
+ """Autogenerated stub for doCalibration. The runtime implementation is only available on the CHECKBOX device."""
806
+ raise NotImplementedError(_RUNTIME_MESSAGE)
807
+
808
+ __all__ = ['LOW', 'HIGH', 'RISING', 'FALLING', 'LEVEL_3V3', 'LEVEL_5V', 'REL1', 'REL2', 'AOUT1', 'AOUT2', 'AIN1', 'AIN2', 'AIN3', 'AIN4', 'AIN5', 'AIN6', 'AIN7', 'AIN8', 'OUT1', 'OUT2', 'OUT3', 'OUT4', 'OUT5', 'OUT6', 'OUT7', 'OUT8', 'OUT9', 'OUT10', 'OUT11', 'OUT12', 'IN1', 'IN2', 'IN3', 'IN4', 'IN5', 'IN6', 'IN7', 'IN8', 'IN9', 'IN10', 'IN11', 'IN12', 'PWMResult', 'setTestframeworkCoreReference', 'prepareTest', 'backToDefaults', 'abortTest', 'abortTestOnFailure', 'keepConfigurationAfterTest', 'enableIOSupply', 'disableIOSupply', 'enableExternalSupply', 'disableExternalSupply', 'enableDUTSupply', 'disableDUTSupply', 'enableRelais', 'disableRelais', 'getInputVoltage', 'setOutputVoltage', 'getInputs', 'isInputHigh', 'isInputLow', 'getInput', 'waitForLow', 'waitForHigh', 'setOutputLow', 'setOutputHigh', 'setOutputPWM', 'getDeviceTemperature', 'sleep_ms', 'sleep', 'getSerialNumber', 'getHWVersion', 'getSWVersion', 'getFrequency', 'getCurrent', 'convertADCToCurrent', 'getUserInputBool', 'getUserInputString', 'getUserInputInt', 'getUserInputFloat', 'getUserInputSerialNumber', 'showUserMessage', 'showProgressBar', 'updateProgressBar', 'hideProgressBar', 'executeCommand', 'getPwm', 'doCalibration']
File without changes
@@ -0,0 +1,448 @@
1
+ """Autogenerated host-side stubs for the CHECKBOX testreport API."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ _RUNTIME_MESSAGE = "This package only provides autogenerated host-side stubs for the CHECKBOX MicroPython API."
8
+
9
+ PASSED: int = True
10
+ FAILED: int = False
11
+
12
+ class ClassTestreport:
13
+ """Autogenerated placeholder for ClassTestreport."""
14
+ def setTestframeworkCoreReference(self, ref):
15
+ """Autogenerated stub for ClassTestreport.setTestframeworkCoreReference."""
16
+ raise NotImplementedError(_RUNTIME_MESSAGE)
17
+
18
+ def handleStop(self):
19
+ """Autogenerated stub for ClassTestreport.handleStop."""
20
+ raise NotImplementedError(_RUNTIME_MESSAGE)
21
+
22
+ def incPassed(self):
23
+ """Autogenerated stub for ClassTestreport.incPassed."""
24
+ raise NotImplementedError(_RUNTIME_MESSAGE)
25
+
26
+ def incFailed(self):
27
+ """Autogenerated stub for ClassTestreport.incFailed."""
28
+ raise NotImplementedError(_RUNTIME_MESSAGE)
29
+
30
+ def checkBool(self, description: str, value: bool, expected: bool = True):
31
+ """
32
+ Checks for a boolean result.
33
+
34
+ :param description: Testdescription which will be placed in the report
35
+ :type description: string
36
+ :param value: The result value which should be checked
37
+ :type value: bool
38
+ :param expected: The expected value
39
+ :type expected: bool
40
+
41
+ Example usage:
42
+
43
+ .. highlight:: python
44
+ .. code-block:: python
45
+
46
+ from testframework import *
47
+
48
+ sensorSignal = getInput(IN3)
49
+ report.checkBool("Is sensor damped?", sensorSignal == HIGH)
50
+ """
51
+ raise NotImplementedError(_RUNTIME_MESSAGE)
52
+
53
+ def checkValueMinMax(self, description, value, min, max, unit = '', digits = 3):
54
+ """
55
+ Checks if a value is within given value range.
56
+
57
+ :param description: Testdescription which will be placed in the report
58
+ :type description: string
59
+ :param value: Value which should be checked
60
+ :type value: int | float
61
+ :param min: Lower limit which is allowed (inclusive this value)
62
+ :type min: int | float
63
+ :param max: Upper limit which is allowed (inclusive this value)
64
+ :type max: int | float
65
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
66
+ :type unit: string
67
+ :param digits: number of digits for the value if the value has type float (digits has no effect in case of integer value).
68
+ :type digits: int
69
+
70
+ **Example usage:**
71
+
72
+ This code checks if the supply voltage, measured at analog input 6, is between 3,25V and 3,35V
73
+
74
+ .. highlight:: python
75
+ .. code-block:: python
76
+
77
+ from testframework import *
78
+
79
+ supplyVoltage = getInputVoltage(AIN6)
80
+ report.checkValueMinMax("Check supply voltage", supplyVoltage, 3.25, 3.35, "V")
81
+ """
82
+ raise NotImplementedError(_RUNTIME_MESSAGE)
83
+
84
+ def checkValueMin(self, description, value, min, unit = '', digits = 3):
85
+ """
86
+ Checks if a value is higher or equal of the given min value.
87
+
88
+ :param description: Testdescription which will be placed in the report
89
+ :type description: string
90
+ :param value: Value which should be checked
91
+ :type value: int | float
92
+ :param min: Lower limit which should the value have minimum (inclusive this value)
93
+ :type min: int | float
94
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
95
+ :type unit: string
96
+ :param digits: number of digits for the value if the value has type float (digits has no effect in case of integer value).
97
+ :type digits: int
98
+
99
+ **Example usage:**
100
+
101
+ This code checks if the supply voltage, measured at analog input 6, is between 3,25V and 3,35V
102
+
103
+ .. highlight:: python
104
+ .. code-block:: python
105
+
106
+ from testframework import *
107
+
108
+ supplyVoltage = getInputVoltage(AIN6)
109
+ report.checkValueMin("Check supply voltage", supplyVoltage, 3.25, "V")
110
+ """
111
+ raise NotImplementedError(_RUNTIME_MESSAGE)
112
+
113
+ def checkValueMax(self, description, value, max, unit = '', digits = 3):
114
+ """
115
+ Checks if a value is lower or equal of the given max value.
116
+
117
+ :param description: Testdescription which will be placed in the report
118
+ :type description: string
119
+ :param value: Value which should be checked
120
+ :type value: int | float
121
+ :param max: Upper limit which should the value have maximum (inclusive this value)
122
+ :type max: int | float
123
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
124
+ :type unit: string
125
+ :param digits: number of digits for the value if the value has type float (digits has no effect in case of integer value).
126
+ :type digits: int
127
+
128
+ **Example usage:**
129
+
130
+ This code checks if the supply voltage, measured at analog input 6, is between 3,25V and 3,35V
131
+
132
+ .. highlight:: python
133
+ .. code-block:: python
134
+
135
+ from testframework import *
136
+
137
+ supplyVoltage = getInputVoltage(AIN6)
138
+ report.checkValueMax("Check supply voltage", supplyVoltage, 3.5, "V")
139
+ """
140
+ raise NotImplementedError(_RUNTIME_MESSAGE)
141
+
142
+ def checkValueTollerance(self, description, value, expected, tol, unit = '', digits = 3):
143
+ """
144
+ Checks if a value is within given value range.
145
+
146
+ :param description: Testdescription which will be placed in the report
147
+ :type description: string
148
+ :param value: Value which should be checked
149
+ :type value: int | float
150
+ :param expected: This is the expected value
151
+ :type expected: int | float
152
+ :param tol: Accepted tolerance for the value (+/-)
153
+ :type tol: int | float
154
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
155
+ :type unit: string
156
+ :param digits: number of digits for the value if the value has type float (digits has no effect in case of integer value).
157
+ :type digits: int
158
+
159
+ **Example usage:**
160
+
161
+ This code checks if the supply voltage, measured at analog input 6, is in the tolerance 3,3V +/- 0,05V
162
+
163
+ .. highlight:: python
164
+ .. code-block:: python
165
+
166
+ from testframework import *
167
+
168
+ supplyVoltage = getInputVoltage(AIN6)
169
+ report.checkValueTollerance("Check supply voltage", supplyVoltage, 3.3, 0.05, "V")
170
+ """
171
+ raise NotImplementedError(_RUNTIME_MESSAGE)
172
+
173
+ def checkValueTolleranceCircular(self, description, value, expected, tol, endValue, unit = '', digits = 3):
174
+ """
175
+ Checks if a value is within given tollerance on a circular value range (0 - ``endValue``).
176
+ For example: If you have an angle which is between 0° and 360° and you expect a target angle of 350° with a tollerance of 20°.
177
+ With this function you can set the expected value to 350, tollerance to 20 and the ``endValue`` to 360. The tollerance range will than automatically wrap around 360°.
178
+ So all values below or equal 10° will lead to a passed result and all values above or equal 330° will lead to a passed result.
179
+ All values outside the given circular range of 0 - ``endValue`` will lead into a failed result.
180
+
181
+ :param description: Testdescription which will be placed in the report
182
+ :type description: string
183
+ :param value: Value which should be checked
184
+ :type value: int | float
185
+ :param expected: This is the expected value
186
+ :type expected: int | float
187
+ :param tol: Accepted tolerance for the value (+/-)
188
+ :type tol: int | float
189
+ :param maxValue: The value on which the range wrapes around.
190
+ :type maxValue: int | float
191
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
192
+ :type unit: string
193
+ :param digits: number of digits for the value if the value has type float (digits has no effect in case of integer value).
194
+ :type digits: int
195
+
196
+ **Example usage:**
197
+
198
+ This code checks if the supply voltage, measured at analog input 6, is in the tolerance 3,3V +/- 0,05V
199
+
200
+ .. highlight:: python
201
+ .. code-block:: python
202
+
203
+ from testframework import *
204
+
205
+ #ext.init() #only neccessary if you run this code in debug console, outside of a testrun
206
+ rs485 = ext.getRS485(0)
207
+ modbus = ModbusMaster(rs485)
208
+
209
+ values = await modbus.readInputRegisters(1, 9, 1) #read the arm-position from slave-ID 1, modbus register 9
210
+ angle = values[0]
211
+ report.checkValueTolleranceCircular("Check if arm is on correct position.", angle, 350, 20, 360)
212
+ """
213
+ raise NotImplementedError(_RUNTIME_MESSAGE)
214
+
215
+ def checkValue(self, description, value, expected, unit = ''):
216
+ """
217
+ Checks whether the value corresponds exactly to the expected value
218
+
219
+ :param description: Testdescription which will be placed in the report
220
+ :type description: string
221
+ :param value: Value which should be checked
222
+ :type value: int | float
223
+ :param expected: This is the expected value
224
+ :type expected: int | float
225
+ :param unit: Unit of the value. This is just for the report. An empty string is allowed.
226
+ :type unit: string
227
+
228
+ **Example usage:**
229
+
230
+ This code checks if the checkbox has Hardware Version 1.
231
+
232
+ .. highlight:: python
233
+ .. code-block:: python
234
+
235
+ from testframework import *
236
+
237
+ hwVersion = getHWVersion()
238
+ report.checkValue("Check Hardware Version", hwVersion, 1)
239
+ """
240
+ raise NotImplementedError(_RUNTIME_MESSAGE)
241
+
242
+ def checkString(self, description, value, expected):
243
+ """
244
+ Checks if the given string equates to the given string.
245
+
246
+ :param description: Testdescription which will be placed in the report
247
+ :type description: string
248
+ :param value: String which should be checked
249
+ :type value: string
250
+ :param expected: This is the expected string
251
+ :type expected: string
252
+
253
+ **Example usage:**
254
+
255
+ .. highlight:: python
256
+ .. code-block:: python
257
+
258
+ from testframework import *
259
+
260
+ uart1.init(9600)
261
+ uart1.send("Wakeup")
262
+ answer = uart1.readline()
263
+ report.checkString("Acknowledge received", answer, "ACK")
264
+
265
+ #Hint: You can do the same check with the following function too:
266
+ report.checkBool("Acknowledge received", answer == "ACK")
267
+ """
268
+ raise NotImplementedError(_RUNTIME_MESSAGE)
269
+
270
+ def checkStringStartsWith(self, description, value, expected):
271
+ """
272
+ Checks if the given string starts with the expected string.
273
+
274
+ :param description: Testdescription which will be placed in the report
275
+ :type description: string
276
+ :param value: String which should be checked
277
+ :type value: string
278
+ :param expected: This is the expected string
279
+ :type expected: string
280
+
281
+ **Example usage:**
282
+
283
+ .. highlight:: python
284
+ .. code-block:: python
285
+
286
+ from testframework import *
287
+
288
+ uart1.init(9600)
289
+ uart1.send("Wakeup")
290
+ answer = uart1.readline()
291
+ report.checkStringStartsWith("Acknowledge received", answer, "ACK")
292
+
293
+ #Hint: You can do the same check with the following function too:
294
+ report.checkBool("Acknowledge received", answer == "ACK")
295
+ """
296
+ raise NotImplementedError(_RUNTIME_MESSAGE)
297
+
298
+ def checkStringContains(self, description, value, expected):
299
+ """
300
+ Checks if the given string contains the expected string.
301
+
302
+ :param description: Testdescription which will be placed in the report
303
+ :type description: string
304
+ :param value: String which should be checked
305
+ :type value: string
306
+ :param expected: This is the expected string
307
+ :type expected: string
308
+
309
+ **Example usage:**
310
+
311
+ .. highlight:: python
312
+ .. code-block:: python
313
+
314
+ from testframework import *
315
+
316
+ uart1.init(9600)
317
+ uart1.send("Wakeup")
318
+ answer = uart1.readline()
319
+ report.checkStringContains("Acknowledge received", answer, "ACK")
320
+
321
+ #Hint: You can do the same check with the following function too:
322
+ report.checkBool("Acknowledge received", answer == "ACK")
323
+ """
324
+ raise NotImplementedError(_RUNTIME_MESSAGE)
325
+
326
+ def putInfoValue(self, description, value, unit = '', digits = 3):
327
+ """
328
+ Enters an 'info only' value to the testreport.
329
+
330
+ :param description: Description which will be placed in the report
331
+ :type description: string
332
+ :param value: value for the report
333
+ :type value: int | float | string
334
+ :param unit: Unit of the value (only for int and float values). This is just for the report. An empty string is allowed.
335
+ :type unit: string
336
+ :param digits: Number of digits for the value if the value has type float (digits has no effect in case of integer value).
337
+ :type unit: int
338
+
339
+ **Example usage:**
340
+
341
+ .. highlight:: python
342
+ .. code-block:: python
343
+
344
+ from testframework import *
345
+
346
+ devTemp = getDeviceTemperature()
347
+ report.putInfoValue("Device temperature", "%.1f" %devTemp)
348
+
349
+ .. warning::
350
+ Unfortunately at the moment the Testbox does not support special characters. So it is not possible to use "°C" as unit in the report.
351
+ """
352
+ raise NotImplementedError(_RUNTIME_MESSAGE)
353
+
354
+ def putInfo(self, description):
355
+ """
356
+ Enters an 'info only' entry to the testreport.
357
+
358
+ :param description: Description which will be placed in the report
359
+ :type description: string
360
+
361
+ **Example usage:**
362
+
363
+ .. highlight:: python
364
+ .. code-block:: python
365
+
366
+ from testframework import *
367
+
368
+ devTemp = getDeviceTemperature()
369
+ report.info("All answers received")
370
+ """
371
+ raise NotImplementedError(_RUNTIME_MESSAGE)
372
+
373
+ def putPassed(self, description):
374
+ """
375
+ Inserts a passed result without any values into the testreport.
376
+
377
+ With both functions :func:`~testreport.ClassTestreport.putPassed` and :func:`~testreport.ClassTestreport.putFailed` you can do your own test inspection.
378
+
379
+ :param description: Description which will be placed in the report
380
+ :type description: string
381
+
382
+ **Example usage:**
383
+
384
+ .. highlight:: python
385
+ .. code-block:: python
386
+
387
+ from testframework import *
388
+
389
+ report.putPassed("Answer received")
390
+ """
391
+ raise NotImplementedError(_RUNTIME_MESSAGE)
392
+
393
+ def putFailed(self, description):
394
+ """See :func:`~testreport.ClassTestreport.putPassed`"""
395
+ raise NotImplementedError(_RUNTIME_MESSAGE)
396
+
397
+ def putPassedFailed(self, description, result):
398
+ """
399
+ Inserts a passed or failed result without any values into the testreport.
400
+
401
+ With this function you can do a quick check if somethin went wrong.
402
+
403
+ :param description: Description which will be placed in the report
404
+ :type description: string
405
+ :param result: ``True`` a *PASSED* result will put into the testreport. ``False`` a *FAILED* result will put into the testreport.
406
+ :type description: bool
407
+
408
+ **Example usage:**
409
+
410
+ .. highlight:: python
411
+ .. code-block:: python
412
+
413
+ from testframework import *
414
+
415
+ val = await modbus.readDiscreteInputs(1,0,6)
416
+ report.putPassedFailed("Answer received", val!=None)
417
+ """
418
+ raise NotImplementedError(_RUNTIME_MESSAGE)
419
+
420
+ def appendTrace(self, description, trace):
421
+ """
422
+ Inserts a trace at the end of the report.
423
+
424
+ :param description: Description which will be used as title of the diagram.
425
+ :type description: string
426
+ :param trace: trace object which should be printed
427
+ :type trace: Trace
428
+
429
+ **Example usage:**
430
+
431
+ .. highlight:: python
432
+ .. code-block:: python
433
+
434
+ from testframework import *
435
+
436
+ data = trace.TraceData(IN1,1000)
437
+ trace.start(data,1000)
438
+
439
+ report.appendTrace("Analog Signal", data)
440
+ """
441
+ raise NotImplementedError(_RUNTIME_MESSAGE)
442
+
443
+ def abortTest(self, msg):
444
+ """Autogenerated stub for ClassTestreport.abortTest."""
445
+ raise NotImplementedError(_RUNTIME_MESSAGE)
446
+ report: ClassTestreport = ClassTestreport()
447
+
448
+ __all__ = ['PASSED', 'FAILED', 'ClassTestreport', 'report']