Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/wapython
Path: blob/main/python/python-wasm/src/test/misc.test.ts
1067 views
1
import { syncPython } from "../node";
2
3
test("that creating a directory works, and can get listing on new directory", async () => {
4
const { exec, repr } = await syncPython();
5
const path = `/tmp/${Math.random()}`;
6
try {
7
exec(`import os; os.makedirs('${path}')`);
8
expect(repr(`os.path.exists('${path}')`)).toBe("True");
9
expect(repr(`os.listdir('${path}')`)).toBe("[]");
10
} finally {
11
exec(`os.rmdir('${path}')`);
12
}
13
});
14
15