[riot-notifications] [RIOT-OS/RIOT] [BUG] testrunner matching local echo (#10952)

Martine Lenders notifications at github.com
Tue Feb 5 16:26:07 CET 2019


miri64 commented on this pull request.



> @@ -0,0 +1,24 @@
+#!/usr/bin/env python3
+
+# TODO TEST FILE ONLY
+# SHOULD NOT BE MERGED
+
+import sys
+import pexpect
+from testrunner import run
+
+def testfunc(child):
+    child.expect_exact("Hello World!")
+
+    child.sendline("the test should not match this")
+    try:
+        child.expect_exact("the test should not match this")

I think the correct way to do this `pexpect` style would be

```suggestion
        res child.expect([pexpect.TIMEOUT, "the test should not match this"])
        if res == 0:
            raise RuntimeError("There should have been a timeout on the match,"
                               " and not match on stdin")
```

See e.g. [this of pexpect's own examples](https://github.com/pexpect/pexpect/blob/master/examples/monitor.py#L108)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10952#pullrequestreview-200133039
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190205/cd331c84/attachment.html>


More information about the notifications mailing list