Path: blob/main/python/python-wasm/src/test/python-async.test.ts
1067 views
import { asyncPython } from "../node";12// TODO: I have seen this test random fail sometimes, where3// it hangs. Not sure why. Hence skipping.4//5// Error is ENOENT: no such file or directory, uv_cwd so I suspect conflict6// between node threads.789test.skip("add 2+3 (async version)", async () => {10const { exec, repr, kernel } = await asyncPython();11await exec("a = 2+3");12expect(await repr("a")).toBe("5");13kernel.terminate();14});1516test.skip("sleeping for a quarter of a second (async version)", async () => {17const { exec, kernel } = await asyncPython();18const t0 = new Date().valueOf();19await exec("import time; time.sleep(0.25)");20const t = new Date().valueOf() - t0;21expect(t >= 240 && t <= 1000).toBe(true);22kernel.terminate();23});24252627