1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-14 17:13:50 +01:00

tests/sys: fix E275 missing whitespace after keyword + cleanup a bit

This commit is contained in:
Alexandre Abadie 2023-05-10 11:31:26 +02:00
parent 50315213e6
commit afc675a2c7
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
4 changed files with 12 additions and 14 deletions

View File

@ -6,7 +6,6 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
from __future__ import print_function
import sys
from testrunner import run
@ -23,7 +22,7 @@ def testfunc(child):
# check if output is correct
expected = int(child.match.group(2))
actual = int(child.match.group(1))
assert(actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR + 1))
assert actual in range(expected - ACCEPTED_ERROR, expected + ACCEPTED_ERROR + 1)
print(".", end="", flush=True)
print("")
print("All tests successful")

View File

@ -6,7 +6,6 @@
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.
from __future__ import print_function
import sys
from testrunner import run

View File

@ -19,7 +19,7 @@ def testfunc(child):
sleeps.append([sleep, child_num])
for _, child_num in sorted(sleeps):
child.expect(r'Done (\d+)\r\n')
assert(child_num == int(child.match.group(1)))
assert child_num == int(child.match.group(1))
child.expect('SUCCESS')

View File

@ -14,7 +14,7 @@ class PufSram:
def __init__(self, port, baud):
self.__dev = serial.Serial(port, baud, timeout=10)
if(self.__dev.isOpen() is False):
if self.__dev.isOpen() is False:
self.__dev.open()
def repower(self, shutdown_time):
@ -26,15 +26,15 @@ class PufSram:
data = None
start = False
str = 'no_exit'
while (str != ''):
while str != '':
str = self.__dev.readline()
if (b'Start: ' in str):
if b'Start: ' in str:
start = True
if ((b'Success: ' in str) and (start is True)):
if (b'[' in str) and (b']' in str):
data_str = str[str.find(b"[")+1:str.find(b"]")]
if b'Success: ' in str and start is True:
if b'[' in str and b']' in str:
data_str = str[str.find(b"[") + 1:str.find(b"]")]
data = int(data_str, 0)
if ((b'End: ' in str) and (data is not None)):
if b'End: ' in str and data is not None:
return data
return None
@ -43,16 +43,16 @@ class PufSram:
for i in range(0, n):
self.repower(off_time)
data.append(self.read_data())
if (allow_print):
if allow_print:
print('Iteration %i/%i' % (i, n))
print(data[-1])
return data
def connect(self, dev):
if (dev.isOpen()):
if dev.isOpen():
dev.close()
self.__dev = self
if(self.__dev.isOpen() is False):
if self.__dev.isOpen() is False:
self.__dev.open()
def disconnect(self):