def test_runtime_available(self): runtime = execjs.ExternalRuntime(command=["nonexistent"], name=None, runner_path=None) self.assertFalse(runtime.is_available()) runtime = execjs.ExternalRuntime(command=["python"], name=None, runner_path=None) self.assertTrue(runtime.is_available()) raise Exception
def backend(self): "Internal property that returns the Node script running harness" if self._backend is None: with io.open(path.join(path.abspath(path.dirname(__file__)), "runner.js")) as runner_file: runner_source = runner_file.read() self._backend = execjs.ExternalRuntime(name="Node.js (V8)", command=["node"], runner_source=runner_source) return self._backend
def test_runtime_availability(self): r = execjs.ExternalRuntime("fail", ["nonexistent"], "") self.assertFalse(r.is_available()) r = execjs.ExternalRuntime("success", ["python"], "") self.assertTrue(r.is_available())