@Test
public void testMultithreadedEval() throws InterruptedException {

    Assume.assumeTrue(shouldRunMaven);
    int executionsNum = 5;
    final String varName = "ABC";
    final String varValue = "YYY";
    final CountDownLatch latch = new CountDownLatch(executionsNum);
    for(int i = 0; i < executionsNum; i++) {
        final int executioId = i;
        new Thread() {
            public void run() {
                try {
                    Map<String, String> sysProps = new HashMap<>();
                    String value = varValue + executioId;
                    sysProps.put(varName, value);
                    String doubleName = varName + varName;
                    String doubleValue = value + value;
                    Map<String, Serializable> vars = new HashMap<>();
                    vars.put(doubleName, doubleValue);
                    vars.put(SYSTEM_PROPERTIES_MAP, (Serializable) sysProps);
                    String prepareEnvironmentScript = buildAddFunctionsScript(GET_SP_FUNCTION_DEFINITION);
                    String script = "check_env('" + varName + "', '" + value + "', '" + doubleName + "', '" + doubleValue + "')";
                    PythonEvaluationResult result = pythonRuntimeService.eval(prepareEnvironmentScript, script, vars);
                    String [] pyResults = ((String) result.getEvalResult()).split(",");
                    assertNotNull(pyResults.length == 2);
                    String [] sysValues = pyResults[0].split(":");
                    assertNotNull(sysValues.length == 2);
                    assertEquals(sysValues[0], sysValues[1]);
                    String [] globalValues = pyResults[1].split(":");
                    assertNotNull(globalValues.length == 2);
                    assertEquals(globalValues[0], globalValues[1]);
                } finally {
                    latch.countDown();
                }
            }
        }.start();
    }
    latch.await();
}