Adding timeout for py4j gateway to have time to shutdown

This commit is contained in:
Alexander Bezzubov 2016-07-05 19:16:44 +09:00
parent 3529fe5ee6
commit 1be77325bf

View file

@ -114,7 +114,7 @@ public class PythonInterpreterTest {
* is sent to interpreter and JavaGateway is running
*/
@Test
public void testPy4jInstalled() throws IOException {
public void testPy4jInstalled() throws IOException, InterruptedException {
when(mockPythonProcess.sendAndGetResult(eq("\n\nimport py4j\n"))).thenReturn(">>>");
pythonInterpreter.open();
@ -130,6 +130,7 @@ public class PythonInterpreterTest {
assertTrue(serverIsListeningOn(py4jPort));
pythonInterpreter.close();
TimeUnit.SECONDS.sleep(1);
assertFalse(serverIsListeningOn(py4jPort));
}