tests: fix python style 'E302 expected 2 blank lines, found 1'

This commit is contained in:
Alexandre Abadie 2017-11-18 20:15:38 +01:00
parent 071d9c2d7f
commit c4f66edba1
52 changed files with 82 additions and 5 deletions

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("Start.")
child.expect('\+ bitarithm_msb: \d+ iterations per second')

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("Testing Bloom filter.")
child.expect_exact("m: 4096 k: 8")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("On-board button test")
index = child.expect([

View File

@ -14,6 +14,7 @@ import testrunner
ACCEPTED_ERROR = 20
def testfunc(child):
child.expect_exact('Data:')
child.expect_exact('(uint64_t, 1)')

View File

@ -13,8 +13,8 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
def testfunc(child):
child.expect_exact("************ C++ condition_variable test ***********")
child.expect_exact("Wait with predicate and notify one ...")
child.expect_exact("Done")

View File

@ -13,8 +13,8 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
def testfunc(child):
child.expect_exact("************ C++ mutex test ***********")
child.expect_exact("Lock and unlock ...")
child.expect_exact("Done")

View File

@ -13,8 +13,8 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
def testfunc(child):
child.expect_exact("************ C++ thread test ***********")
child.expect_exact("Creating one thread and passing an argument ...")
child.expect_exact("Done")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect([r"OK \([0-9]+ tests\)",
r"error: unable to initialize RTC \[I2C initialization error\]"])

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact(u"[SUCCESS]", timeout=60)

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("[START]")
child.expect_exact("[SUCCESS]")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("[SUCCESS]", timeout=60)

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact(u"[SUCCESS]")

View File

@ -15,6 +15,7 @@ import testrunner
ACCEPTED_ERROR = 20
def testfunc(child):
child.expect(r"Testing generic evtimer \(start time = (\d+) ms\)")
timer_offset = int(child.match.group(1))

View File

@ -15,6 +15,7 @@ import testrunner
how_many = 100
def testfunc(child):
for i in range(how_many):
for j in range(8):

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("Testing floating point arithmetics...")
child.expect_exact("[SUCCESS]")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
index = child.expect_exact([
"ipv6: Received (src = fd01::1, dst = fd01::2, next header = 0, length = 42)",

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect(r"OK \(\d+ tests\)")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect(r"OK \(\d+ tests\)")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
# 1st 6LoWPAN fragment
child.expect(r"OK \(\d+ tests\)")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
# embUnit tests
child.expect(r"OK \(\d+ tests\)")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
# 1st 6LoWPAN fragment
child.expect_exact("PKTDUMP: data received:")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact(u"Calling test_sock_ip_create__EAFNOSUPPORT()")
child.expect_exact(u"Calling test_sock_ip_create__EINVAL_addr()")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact(u"Calling test_sock_udp_create__EADDRINUSE()")
child.expect_exact(u"Calling test_sock_udp_create__EAFNOSUPPORT()")

View File

@ -47,6 +47,7 @@ FUNS = {
ABS_ERROR_LIMIT = 0.011
def main():
total = 0
errors = 0

View File

@ -17,6 +17,7 @@ import pexpect
DEFAULT_TIMEOUT = 5
class Strategy(object):
def __init__(self, func=None):
if func != None:
@ -28,11 +29,13 @@ class Strategy(object):
def execute(self, *args, **kwargs):
raise NotImplementedError()
class ApplicationStrategy(Strategy):
def __init__(self, app_dir=os.getcwd(), func=None):
super(ApplicationStrategy, self).__init__(func)
self.app_dir = app_dir
class BoardStrategy(Strategy):
def __init__(self, board, func=None):
super(BoardStrategy, self).__init__(func)
@ -50,22 +53,27 @@ class BoardStrategy(Strategy):
def execute(self, application):
super(BoardStrategy, self).execute(application)
class CleanStrategy(BoardStrategy):
def execute(self, application, env=None):
super(CleanStrategy, self).__run_make(application, ("-B", "clean"), env)
class BuildStrategy(BoardStrategy):
def execute(self, application, env=None):
super(BuildStrategy, self).__run_make(application, ("all",), env)
class FlashStrategy(BoardStrategy):
def execute(self, application, env=None):
super(FlashStrategy, self).__run_make(application, ("all",), env)
class ResetStrategy(BoardStrategy):
def execute(self, application, env=None):
super(ResetStrategy, self).__run_make(application, ("reset",), env)
class Board(object):
def __init__(self, name, port=None, serial=None, clean=None,
build=None, flash=None,
@ -119,6 +127,7 @@ class Board(object):
def reset(self, application=os.getcwd(), env=None):
self.reset_strategy.execute(application, env)
class BoardGroup(object):
def __init__(self, boards):
self.boards = boards
@ -148,6 +157,7 @@ class BoardGroup(object):
for board in self.boards:
board.reset(application, env)
def default_test_case(board_group, application, env=None):
for board in board_group:
env = os.environ.copy()
@ -159,6 +169,7 @@ def default_test_case(board_group, application, env=None):
logfile=sys.stdout) as spawn:
spawn.expect("TEST: SUCCESS")
class TestStrategy(ApplicationStrategy):
def execute(self, board_groups, test_cases=[default_test_case],
timeout=DEFAULT_TIMEOUT, env=None):
@ -171,11 +182,13 @@ class TestStrategy(ApplicationStrategy):
sys.stdout.flush()
print()
def get_ipv6_address(spawn):
spawn.sendline(u"ifconfig")
spawn.expect(u"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)")
return spawn.match.group(1)
def test_ipv6_send(board_group, application, env=None):
env_sender = os.environ.copy()
if env != None:
@ -199,6 +212,7 @@ def test_ipv6_send(board_group, application, env=None):
(receiver_ip, ipprot))
receiver.expect(u"00000000 01 23 45 67 89 AB CD EF")
def test_udpv6_send(board_group, application, env=None):
env_sender = os.environ.copy()
if env != None:
@ -223,6 +237,7 @@ def test_udpv6_send(board_group, application, env=None):
(receiver_ip, port))
receiver.expect(u"00000000 AB CD EF")
def test_tcpv6_send(board_group, application, env=None):
env_client = os.environ.copy()
if env != None:
@ -252,6 +267,7 @@ def test_tcpv6_send(board_group, application, env=None):
client.sendline(u"tcp send affe:abe")
client.expect_exact(u"could not send")
def test_triple_send(board_group, application, env=None):
env_sender = os.environ.copy()
if env != None:

View File

@ -12,12 +12,15 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def _ipv6_tests(code):
return code & (1 << 6)
def _ipv4_tests(code):
return code & (1 << 4)
def testfunc(child):
child.expect(u"code (0x[0-9a-f]{2})")
code = int(child.match.group(1), base=16)

View File

@ -12,15 +12,19 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def _reuse_tests(code):
return code & 1
def _ipv6_tests(code):
return code & (1 << 6)
def _ipv4_tests(code):
return code & (1 << 4)
def testfunc(child):
child.expect(u"code (0x[0-9a-f]{2})")
code = int(child.match.group(1), base=16)

View File

@ -12,15 +12,19 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def _reuse_tests(code):
return code & 1
def _ipv6_tests(code):
return code & (1 << 6)
def _ipv4_tests(code):
return code & (1 << 4)
def testfunc(child):
child.expect(u"code (0x[0-9a-f]{2})")
code = int(child.match.group(1), base=16)

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact(u"[SUCCESS]")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect(u"Test successful.")

View File

@ -21,6 +21,7 @@ thread_prio = {
7: 1
}
def testfunc(child):
for k in thread_prio.keys():
child.expect(u"T%i \(prio %i\): trying to lock mutex now" % (k, thread_prio[k]))

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("od_hex_dump(short_str, sizeof(short_str), OD_WIDTH_DEFAULT)")
child.expect_exact("00000000 41 42 00")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("od_hex_dump(short_str, sizeof(short_str), OD_WIDTH_DEFAULT)")
child.expect_exact("00000000 41 42 00 AB.")

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect('Decoding finished succesfully')

View File

@ -12,8 +12,8 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
def testfunc(child):
child.expect(u".... . ._.. ._.. ___ / ._. .. ___ _ ___ ...", timeout=30)
child.expect(u"_ .... .. ... / .. ... / .._ __ ___ ._. ... .", timeout=30)

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def test1(term):
term.expect_exact("######################### TEST1:")
term.expect_exact("first: sem_init")
@ -34,6 +35,7 @@ def test1(term):
term.expect_exact("first: sem_destroy")
term.expect_exact("first: end")
def test2(term):
term.expect_exact("######################### TEST2:")
term.expect_exact("first: sem_init")
@ -64,6 +66,7 @@ def test2(term):
term.expect_exact("Thread 'priority 5' woke up.")
term.expect_exact("Back in main thread.")
def test3(term):
term.expect_exact("######################### TEST3:")
term.expect_exact("first: sem_init s1")
@ -80,6 +83,7 @@ def test3(term):
term.expect_exact("post s1")
term.expect_exact("Thread 2 woke up after waiting for s1.")
def test4(term):
term.expect_exact("######################### TEST4:")
term.expect_exact("first: sem_init s1")
@ -87,6 +91,7 @@ def test4(term):
term.expect_exact("first: timed out")
term.expect(r"first: waited 1\d{6} usec")
def testfunc(child):
test1(child)
test2(child)

View File

@ -18,9 +18,11 @@ import testrunner
US_PER_SEC = 1000000
EXTERNAL_JITTER = 0.15
class InvalidTimeout(Exception):
pass
def testfunc(child):
try:
child.expect_exact("Please hit any key and then ENTER to continue")

View File

@ -35,6 +35,7 @@ PS_EXPECTED = (
('\t | SUM | | | \d+ (\d+)')
)
def _check_startup(child):
for i in range(5):
child.expect_exact('Creating thread #{}, next={}'

View File

@ -30,9 +30,11 @@ lock_depth = {
7: 5
}
def thread_prio_sort(x):
return thread_prio.get(x)*1000 + x
def testfunc(child):
for k in thread_prio.keys():
child.expect(u"T%i \(prio %i, depth 0\): trying to lock rmutex now" %

View File

@ -13,6 +13,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect(r"MAIN: reply from T-\d+")
child.expect(r"MAIN: \d+! = \d+")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect('sender_thread start\r\n')
child.expect('main thread alive\r\n')

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect('sender_thread start\r\n')
child.expect('main thread alive\r\n')

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("[START]")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect(u"OK \\([0-9]+ tests\\)")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("[START]")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect("[START]")
for i in range(5):

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("[START]")
child.expect(u"\[RESULTS\] min=\d+, avg=\d+, max=\d+")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("xtimer_periodic_wakeup test application.")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("xtimer_remove test application.")
child.expect_exact("Setting 3 timers, removing timer 0/3")

View File

@ -12,6 +12,7 @@ import sys
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
child.expect_exact("This test tests re-setting of an already active timer.")
child.expect_exact("It should print three times \"now=<value>\", with "

View File

@ -20,9 +20,11 @@ US_PER_SEC = 1000000
INTERNAL_JITTER = 0.05
EXTERNAL_JITTER = 0.15
class InvalidTimeout(Exception):
pass
def testfunc(child):
child.expect(u"Running test (\\d+) times with (\\d+) distinct sleep times")
RUNS = int(child.match.group(1))

View File

@ -13,8 +13,8 @@ import pexpect
sys.path.append(os.path.join(os.environ['RIOTBASE'], 'dist/tools/testrunner'))
import testrunner
def testfunc(child):
def testfunc(child):
child.expect(u"This test will call xtimer_usleep for values from \\d+ down to \\d+\r\n")
i = 500