class JythonScriptEngine implements ScriptEngine {

  @Override public WorkerRunnable createWorkerRunnable()
    throws EngineException {

    final PyObject pyTestRunner;

    try {
      // Script does per-thread initialisation here and
      // returns a callable object.
      pyTestRunner = m_testRunnerFactory.__call__();
    }
    catch (final PyException e) {
      throw new JythonScriptExecutionException(
        "creating per-thread TestRunner object", e);
    }

    if (!pyTestRunner.isCallable()) {
      throw new JythonScriptExecutionException(
        "The result of '" + TEST_RUNNER_CALLABLE_NAME +
        "()' is not callable");
    }

    return new JythonWorkerRunnable(pyTestRunner);
  }

  public  JythonScriptEngine(final ScriptLocation script);

}