mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 10:03:50 +01:00
tests/sys: fix E275 missing whitespace after keyword + cleanup a bit
This commit is contained in:
parent
50315213e6
commit
afc675a2c7
@ -6,7 +6,6 @@
|
|||||||
# General Public License v2.1. See the file LICENSE in the top level
|
# General Public License v2.1. See the file LICENSE in the top level
|
||||||
# directory for more details.
|
# directory for more details.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
import sys
|
||||||
from testrunner import run
|
from testrunner import run
|
||||||
|
|
||||||
@ -23,7 +22,7 @@ def testfunc(child):
|
|||||||
# check if output is correct
|
# check if output is correct
|
||||||
expected = int(child.match.group(2))
|
expected = int(child.match.group(2))
|
||||||
actual = int(child.match.group(1))
|
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(".", end="", flush=True)
|
||||||
print("")
|
print("")
|
||||||
print("All tests successful")
|
print("All tests successful")
|
||||||
|
|||||||
@ -6,7 +6,6 @@
|
|||||||
# General Public License v2.1. See the file LICENSE in the top level
|
# General Public License v2.1. See the file LICENSE in the top level
|
||||||
# directory for more details.
|
# directory for more details.
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import sys
|
import sys
|
||||||
from testrunner import run
|
from testrunner import run
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ def testfunc(child):
|
|||||||
sleeps.append([sleep, child_num])
|
sleeps.append([sleep, child_num])
|
||||||
for _, child_num in sorted(sleeps):
|
for _, child_num in sorted(sleeps):
|
||||||
child.expect(r'Done (\d+)\r\n')
|
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')
|
child.expect('SUCCESS')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ class PufSram:
|
|||||||
|
|
||||||
def __init__(self, port, baud):
|
def __init__(self, port, baud):
|
||||||
self.__dev = serial.Serial(port, baud, timeout=10)
|
self.__dev = serial.Serial(port, baud, timeout=10)
|
||||||
if(self.__dev.isOpen() is False):
|
if self.__dev.isOpen() is False:
|
||||||
self.__dev.open()
|
self.__dev.open()
|
||||||
|
|
||||||
def repower(self, shutdown_time):
|
def repower(self, shutdown_time):
|
||||||
@ -26,15 +26,15 @@ class PufSram:
|
|||||||
data = None
|
data = None
|
||||||
start = False
|
start = False
|
||||||
str = 'no_exit'
|
str = 'no_exit'
|
||||||
while (str != ''):
|
while str != '':
|
||||||
str = self.__dev.readline()
|
str = self.__dev.readline()
|
||||||
if (b'Start: ' in str):
|
if b'Start: ' in str:
|
||||||
start = True
|
start = True
|
||||||
if ((b'Success: ' in str) and (start is True)):
|
if b'Success: ' in str and start is True:
|
||||||
if (b'[' in str) and (b']' in str):
|
if b'[' in str and b']' in str:
|
||||||
data_str = str[str.find(b"[") + 1:str.find(b"]")]
|
data_str = str[str.find(b"[") + 1:str.find(b"]")]
|
||||||
data = int(data_str, 0)
|
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 data
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -43,16 +43,16 @@ class PufSram:
|
|||||||
for i in range(0, n):
|
for i in range(0, n):
|
||||||
self.repower(off_time)
|
self.repower(off_time)
|
||||||
data.append(self.read_data())
|
data.append(self.read_data())
|
||||||
if (allow_print):
|
if allow_print:
|
||||||
print('Iteration %i/%i' % (i, n))
|
print('Iteration %i/%i' % (i, n))
|
||||||
print(data[-1])
|
print(data[-1])
|
||||||
return data
|
return data
|
||||||
|
|
||||||
def connect(self, dev):
|
def connect(self, dev):
|
||||||
if (dev.isOpen()):
|
if dev.isOpen():
|
||||||
dev.close()
|
dev.close()
|
||||||
self.__dev = self
|
self.__dev = self
|
||||||
if(self.__dev.isOpen() is False):
|
if self.__dev.isOpen() is False:
|
||||||
self.__dev.open()
|
self.__dev.open()
|
||||||
|
|
||||||
def disconnect(self):
|
def disconnect(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user