If a subprocess gets killed by an OOM killer or whatever it should respawn and raise an InternalError

This commit is contained in:
Dave Halter
2018-01-02 00:56:22 +01:00
parent 7ff6871548
commit bcb3f02a01
2 changed files with 25 additions and 1 deletions

View File

@@ -58,3 +58,16 @@ def test_error_in_environment(evaluator, Script):
# Jedi should still work.
def_, = Script('str').goto_definitions()
assert def_.name == 'str'
def test_killed_subprocess(evaluator, Script):
# Just kill the subprocess.
evaluator.compiled_subprocess._compiled_subprocess._process.kill()
# Since the process was terminated (and nobody knows about it) the first
# Jedi call fails.
with pytest.raises(jedi.InternalError):
Script('str').goto_definitions()
def_, = Script('str').goto_definitions()
# Jedi should now work again.
assert def_.name == 'str'