[riot-notifications] [RIOT-OS/RIOT] dist/pythonlibs: provide unittest TestCase wrapper for testrunner (#10431)

Gaƫtan Harter notifications at github.com
Tue Jan 29 18:07:19 CET 2019

cladmi commented on this pull request.

> +# default value (3)
+def list_until(l, cond):
+    return l[:([i for i, e in enumerate(l) if cond(e)][0])]
+def find_exc_origin(exc_info):
+    pos = list_until(extract_tb(exc_info),
+                     lambda frame: frame[0].startswith(PEXPECT_PATH)
+                     )[-1]
+    return (pos[3], os.path.relpath(os.path.abspath(pos[0]), RIOTBASE), pos[1])
+def setup_child(timeout=10, spawnclass=pexpect.spawnu, env={}, logfile=None):

This one is a dangerous pattern. Because if anything modifies `env` in the function, it updates the default argument for all the other calls.
Also giving `{}` means give no environment which is different from giving the default `None`.
The documentation does not explicit it but it is the case.

If I remove the `os.environ` in `run` it fails with as `test` is using `native`.

BOARD=iotlab-m3 make -C tests/bloom_bytes/ flash test
Terminal program /home/harter/work/git/RIOT/tests/bloom_bytes/bin/native/tests_bloom_bytes.elf is required but not found in PATH.  Aborting.
/home/harter/work/git/RIOT/tests/bloom_bytes/../../Makefile.include:540: recipe for target 'term' failed
make: *** [term] Error 1
Unexpected end of file in expect script at "child.expect_exact("Testing Bloom filter.")" (tests/bloom_bytes/tests/01-run.py:17)

Process already stopped
/home/harter/work/git/RIOT/tests/bloom_bytes/../../Makefile.include:568: recipe for target 'test' failed
make: *** [test] Error 1
make: Leaving directory '/home/harter/work/git/RIOT/tests/bloom_bytes'

def setup_child(timeout=10, spawnclass=pexpect.spawnu, env=None, logfile=None):

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190129/6ae94206/attachment.html>

More information about the notifications mailing list