Skip to content

Commit

Permalink
fixup! fixup! tests: add tests to reproduce RIOT-OS#10881
Browse files Browse the repository at this point in the history
Port to unittest
  • Loading branch information
miri64 committed Mar 28, 2019
1 parent 64b1404 commit 9f4ac4a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/thread_msg_block_race/tests/01-run.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
# directory for more details.

import sys
from testrunner import run
from testrunner.unittest import PexpectTestCase
from pexpect import TIMEOUT
import unittest


def testfunc(child):
res = child.expect([TIMEOUT, "Message was not written"])
# we actually want the timeout here. The application runs into an assertion
# pretty quickly when failing and runs forever on success
assert(res == 0)
class TestMessageNotWritten(PexpectTestCase):
def test_message_not_written(self):
with self.assertRaises(TIMEOUT):
# we actually want the timeout here. The application runs into an
# assertion pretty quickly when failing and runs forever on success
self.spawn.expect("Message was not written")


if __name__ == "__main__":
sys.exit(run(testfunc, timeout=10))
unittest.main()

0 comments on commit 9f4ac4a

Please sign in to comment.