Simplify testprocess tests.
This commit is contained in:
parent
10e52c6e9f
commit
547fc9f40e
@ -93,14 +93,14 @@ class TestWaitFor:
|
|||||||
|
|
||||||
def test_successful(self, pyproc):
|
def test_successful(self, pyproc):
|
||||||
"""Using wait_for with the expected text."""
|
"""Using wait_for with the expected text."""
|
||||||
pyproc.code = "import time; time.sleep(0.5); print('foobar')"
|
pyproc.code = "time.sleep(0.5); print('foobar')"
|
||||||
pyproc.start()
|
pyproc.start()
|
||||||
with stopwatch(min_ms=300): # on Windows, this can be done faster...
|
with stopwatch(min_ms=300): # on Windows, this can be done faster...
|
||||||
pyproc.wait_for(data="foobar")
|
pyproc.wait_for(data="foobar")
|
||||||
|
|
||||||
def test_other_text(self, pyproc):
|
def test_other_text(self, pyproc):
|
||||||
"""Test wait_for when getting some unrelated text."""
|
"""Test wait_for when getting some unrelated text."""
|
||||||
pyproc.code = "import time; time.sleep(0.1); print('blahblah')"
|
pyproc.code = "time.sleep(0.1); print('blahblah')"
|
||||||
pyproc.start()
|
pyproc.start()
|
||||||
with pytest.raises(testprocess.WaitForTimeout):
|
with pytest.raises(testprocess.WaitForTimeout):
|
||||||
pyproc.wait_for(data="foobar", timeout=500)
|
pyproc.wait_for(data="foobar", timeout=500)
|
||||||
@ -121,7 +121,7 @@ class TestWaitFor:
|
|||||||
|
|
||||||
def test_existing_message_previous_test(self, pyproc):
|
def test_existing_message_previous_test(self, pyproc):
|
||||||
"""Make sure the message of a previous test gets ignored."""
|
"""Make sure the message of a previous test gets ignored."""
|
||||||
pyproc.code = "import time; time.sleep(0.1); print('foobar')"
|
pyproc.code = "time.sleep(0.1); print('foobar')"
|
||||||
pyproc.start()
|
pyproc.start()
|
||||||
pyproc.wait_for(data="foobar")
|
pyproc.wait_for(data="foobar")
|
||||||
pyproc.after_test()
|
pyproc.after_test()
|
||||||
|
Loading…
Reference in New Issue
Block a user