Skip to content

Commit

Permalink
Print Python logs
Browse files Browse the repository at this point in the history
  • Loading branch information
x0k committed Jun 6, 2024
1 parent bf3ce1b commit c1e27a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/components/editor/testing-panel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
theme: makeTheme("business"),
fontFamily: "monospace",
convertEol: true,
rows: 1,
})
const fitAddon = new FitAddon()
term.loadAddon(fitAddon)
Expand Down
4 changes: 2 additions & 2 deletions src/content/design-patterns/factory/python/test-runners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ class SimpleTestRunner extends PyTestRunner<Input, Output> {
}
}

export const testRunnerFactory = async ({ code }: TestRunnerConfig) =>
new SimpleTestRunner(await pyRuntimeFactory(), code);
export const testRunnerFactory = async ({ code, out }: TestRunnerConfig) =>
new SimpleTestRunner(await pyRuntimeFactory(out), code);
5 changes: 4 additions & 1 deletion src/lib/testing/python/py-runtime-factory.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { loadPyodide } from "pyodide";

export const pyRuntimeFactory = () =>
import type { Writer } from '@/lib/logger';

export const pyRuntimeFactory = (writer: Writer) =>
loadPyodide({
indexURL: import.meta.env.DEV
? undefined
: `${import.meta.env.BASE_URL}/assets/pyodide`,
stdout: writer.writeln.bind(writer),
});

0 comments on commit c1e27a0

Please sign in to comment.