8000 Fix #2309 - Use all config options (#2310) · pyscript/pyscript@f2bbc6e · GitHub
[go: up one dir, main page]

Skip to content

Commit f2bbc6e

Browse files
Fix #2309 - Use all config options (#2310)
* Fix #2309 - Use all config options * dropped websocket test as it takes forever even locally
1 parent 1d666b9 commit f2bbc6e

File tree

7 files changed

+187
-164
lines changed

7 files changed

+187
-164
lines changed

core/package-lock.json

Lines changed: 152 additions & 147 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pyscript/core",
3-
"version": "0.6.35",
3+
"version": "0.6.36",
44
"type": "module",
55
"description": "PyScript",
66
"module": "./index.js",
@@ -66,7 +66,7 @@
6666
"@webreflection/idb-map": "^0.3.2",
6767
"add-promise-listener": "^0.1.3",
6868
"basic-devtools": "^0.1.6",
69-
"polyscript": "^0.16.17",
69+
"polyscript": "^0.16.21",
7070
"sabayon": "^0.6.6",
7171
"sticky-module": "^0.1.1",
7272
"to-json-callback": "^0.1.1",
@@ -77,9 +77,9 @@
7777
"@codemirror/lang-python": "^6.1.7",
7878
"@codemirror/language": "^6.10.8",
7979
"@codemirror/state": "^6.5.2",
80-
"@codemirror/view": "^6.36.3",
81-
"@playwright/test": "1.45.3",
82-
"@rollup/plugin-commonjs": "^28.0.2",
80+
"@codemirror/view": "^6.36.4",
81+
"@playwright/test": "^1.51.0",
82+
"@rollup/plugin-commonjs": "^28.0.3",
8383
"@rollup/plugin-node-resolve": "^16.0.0",
8484
"@rollup/plugin-terser": "^0.4.4",
8585
"@webreflection/toml-j0.4": "^1.1.3",
@@ -90,14 +90,14 @@
9090
"chokidar": "^4.0.3",
9191
"codedent": "^0.1.2",
9292
"codemirror": "^6.0.1",
93-
"eslint": "^9.21.0",
93+
"eslint": "^9.22.0",
9494
"flatted": "^3.3.3",
95-
"rollup": "^4.34.8",
95+
"rollup": "^4.35.0",
9696
"rollup-plugin-postcss": "^4.0.2",
9797
"rollup-plugin-string": "^3.0.0",
9898
"static-handler": "^0.5.3",
9999
"string-width": "^7.2.0",
100-
"typescript": "^5.7.3",
100+
"typescript": "^5.8.2",
101101
"xterm-readline": "^1.1.2"
102102
},
103103
"repository": {

core/src/plugins/py-game.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
import { dedent, define } from "polyscript/exports";
1+
import {
2+
dedent,
3+
define,
4+
createProgress,
5+
loadProgress,
6+
} from "polyscript/exports";
27

38
import { stdlib } from "../core.js";
49
import { configDetails } from "../config.js";
510
import { getText } from "../fetch.js";
611

12+
const progress = createProgress("py-game");
13+
714
let toBeWarned = true;
815

916
const hooks = {
@@ -17,7 +24,7 @@ const hooks = {
1724
let config = {};
1825
if (script.hasAttribute("config")) {
1926
const value = script.getAttribute("config");
20-
const { json, toml, text } = configDetails(value);
27+
const { json, toml, text, url } = await configDetails(value);
2128
if (json) config = JSON.parse(text);
2229
else if (toml) {
2330
const { parse } = await import(
@@ -32,6 +39,13 @@ const hooks = {
3239
});
3340
micropip.destroy();
3441
}
42+
await loadProgress(
43+
"py-game",
44+
progress,
45+
wrap.interpreter,
46+
config,
47+
url || location.href,
48+
);
3549
}
3650

3751
wrap.interpreter.registerJsModule("_pyscript", {

core/tests/manual/game/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<script type="module" src="../../../dist/core.js"></script>
99
</head>
1010
<body>
11-
<script type="py-game" src="aliens.py"></script>
11+
<script type="py-game" src="aliens.py" config="{}"></script>
1212
<div class="demo">
1313
<div class="demo-header">pygame.examples.aliens</div>
1414
<div class="demo-content">

core/tests/py_tests.main.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { test, expect } from '@playwright/test';
22

3-
test.setTimeout(30 * 1000);
3+
const timeout = 60 * 1000;
4+
5+
test.setTimeout(timeout);
46

57
test('Python unit tests - MicroPython on MAIN thread', async ({ page }) => {
68
await page.goto('http://localhost:8080/tests/python/index.html');
79
const result = page.locator("#result"); // Payload for results will be here.
8-
await result.waitFor(); // wait for the result.
10+
await result.waitFor({ timeout }); // wait for the result.
911
const data = JSON.parse(await result.textContent()); // get the result data.
1012
await expect(data.fails).toMatchObject([]); // ensure no test failed.
1113
});
1214

1315
test('Python unit tests - Pyodide on MAIN thread', async ({ page }) => {
1416
await page.goto('http://localhost:8080/tests/python/index.html?type=py');
1517
const result = page.locator("#result"); // Payload for results will be here.
16-
await result.waitFor(); // wait for the result.
18+
await result.waitFor({ timeout }); // wait for the result.
1719
const data = JSON.parse(await result.textContent()); // get the result data.
1820
await expect(data.fails).toMatchObject([]); // ensure no test failed.
1921
});

core/tests/py_tests.worker.spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
import { test, expect } from '@playwright/test';
22

3-
test.setTimeout(120 * 1000);
3+
const timeout = 120 * 1000;
4+
5+
test.setTimeout(timeout);
46

57
test('Python unit tests - MicroPython on WORKER', async ({ page }) => {
68
await page.goto('http://localhost:8080/tests/python/index.html?worker');
79
const result = page.locator("#result"); // Payload for results will be here.
8-
await result.waitFor(); // wait for the result.
10+
await result.waitFor({ timeout }); // wait for the result.
911
const data = JSON.parse(await result.textContent()); // get the result data.
1012
await expect(data.fails).toMatchObject([]); // ensure no test failed.
1113
});
1214

1315
test('Python unit tests - Pyodide on WORKER', async ({ page }) => {
1416
await page.goto('http://localhost:8080/tests/python/index.html?type=py&worker');
1517
const result = page.locator("#result"); // Payload for results will be here.
16-
await result.waitFor(); // wait for the result.
18+
await result.waitFor({ timeout }); // wait for the result.
1719
const data = JSON.parse(await result.textContent()); // get the result data.
1820
await expect(data.fails).toMatchObject([]); // ensure no test failed.
1921
});

0 commit comments

Comments
 (0)
0