replace exception catch with signal

This commit is contained in:
Kirill Vasin
2019-06-20 13:39:22 +03:00
parent ccb8e338e1
commit 5457c16e76
2 changed files with 10 additions and 5 deletions
+6 -1
View File
@@ -324,10 +324,15 @@ class TestCmdRun(TestDvc):
self.assertEqual(stage.cmd, 'echo "foo bar"')
@mock.patch.object(subprocess, "Popen", side_effect=KeyboardInterrupt)
def test_keyboard_interrupt(self, _):
def test_keyboard_interrupt_before_communicate(self, _):
ret = main(["run", "mycmd"])
self.assertEqual(ret, 252)
@mock.patch.object(subprocess.Popen, "wait", new=KeyboardInterrupt)
def test_keyboard_interrupt_during_communicate(self):
ret = main(["run", "python", "code.py"])
self.assertEqual(ret, 1)
class TestRunRemoveOuts(TestDvc):
def test(self):