From 9a3c3bfcc7d30d65514421bd315f1b8b5b735b86 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Tue, 11 Jun 2024 10:11:34 -0700 Subject: [PATCH] Fix for pyodide test failure, refs #2351 --- test-in-pyodide-with-shot-scraper.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test-in-pyodide-with-shot-scraper.sh b/test-in-pyodide-with-shot-scraper.sh index acd9346595..5845a0c3fd 100755 --- a/test-in-pyodide-with-shot-scraper.sh +++ b/test-in-pyodide-with-shot-scraper.sh @@ -18,6 +18,13 @@ cd dist python3 -m http.server 8529 & cd .. +# Register the kill_server function to be called on script exit +kill_server() { + pkill -f 'http.server 8529' +} +trap kill_server EXIT + + shot-scraper javascript http://localhost:8529/ " async () => { let pyodide = await loadPyodide(); @@ -26,6 +33,8 @@ async () => { import micropip await micropip.install('h11==0.12.0') await micropip.install('httpx==0.23') + # To avoid 'from typing_extensions import deprecated' error: + await micropip.install('typing-extensions>=4.12.2') await micropip.install('http://localhost:8529/$wheel') import ssl import setuptools @@ -38,7 +47,4 @@ async () => { } return 'Test passed!'; } -" - -# Shut down the server -pkill -f 'http.server 8529' +" \ No newline at end of file