From 9e26c673242a1c075f36d0fefc94d86696be584d Mon Sep 17 00:00:00 2001 From: Benedek Racz Date: Thu, 5 Dec 2019 17:27:02 +0100 Subject: [PATCH] [ADD][TST] interact dead; [FIX] add workaround of unreachable codecov --- appveyor.yml | 3 ++- tests/test_interact.py | 19 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 37eeab6..df21093 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -21,7 +21,8 @@ test_script: after_test: # Upload code coverage results. - - codecov + # https://github.com/codecov/codecov-python/issues/158#issuecomment-514282362 + - codecov --required || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) || (sleep 5 && codecov --required) # fill .pypirc file. # pypi diff --git a/tests/test_interact.py b/tests/test_interact.py index cad7b13..953c733 100644 --- a/tests/test_interact.py +++ b/tests/test_interact.py @@ -33,7 +33,7 @@ import unittest from . import PexpectTestCase class InteractTestCase(PexpectTestCase.PexpectTestCase): - def testPath(self): + def test_interact(self): # Path of cmd executable: cmd_exe = 'cmd' cmdPrompt = '>' @@ -54,6 +54,23 @@ class InteractTestCase(PexpectTestCase.PexpectTestCase): p.stop_interact() self.assertEqual('hello', p.before.splitlines()[1]) + + def test_interact_dead(self): + # Path of cmd executable: + echo = 'echo hello' + + # Start the child process + p = wexpect.spawn(echo) + + p.expect('hello') + time.sleep(0.5) + + + with self.assertRaises(wexpect.ExceptionPexpect): + p.interact() + + with self.assertRaises(wexpect.ExceptionPexpect): + p.stop_interact() if __name__ == '__main__': unittest.main()