@@ -74,25 +74,24 @@ async function get(url, mode) {
74
74
75
75
self . onmessage = async ( ) => {
76
76
self . postMessage ( 'Downloading repo archive to get tests...\n' )
77
- const [ python_code , tests_zip , ] = await Promise . all ( [
78
- get ( `./run_tests.py?v=${ Date . now ( ) } ` , 'text' ) ,
79
- // 95c4f56 commit matches the pydantic-core wheel being used, so tests should pass
80
- get ( 'https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/archive/refs/95c4f56/main.zip' , 'blob' ) ,
81
- importScripts ( 'https://cdn.jsdelivr.net/pyodide/v0.21.0a3/full/pyodide.js' )
82
- ] )
83
-
84
- const pyodide = await loadPyodide ( )
85
- const { FS } = pyodide
86
- setupStreams ( FS , pyodide . _module . TTY )
87
- FS . mkdir ( '/test_dir' )
88
- FS . chdir ( '/test_dir' )
89
- await pyodide . loadPackage ( [ 'micropip' , 'pytest' , 'pytz' ] )
90
77
try {
78
+ const [ python_code , tests_zip , ] = await Promise . all ( [
79
+ get ( `./run_tests.py?v=${ Date . now ( ) } ` , 'text' ) ,
80
+ // e4cf2e2 commit matches the pydantic-core wheel being used, so tests should pass
81
+ get ( 'https://githubproxy.samuelcolvin.workers.dev/samuelcolvin/pydantic-core/archive/e4cf2e2.zip' , 'blob' ) ,
82
+ importScripts ( 'https://cdn.jsdelivr.net/pyodide/v0.21.0a3/full/pyodide.js' )
83
+ ] )
84
+
85
+ const pyodide = await loadPyodide ( )
86
+ const { FS } = pyodide
87
+ setupStreams ( FS , pyodide . _module . TTY )
88
+ FS . mkdir ( '/test_dir' )
89
+ FS . chdir ( '/test_dir' )
90
+ await pyodide . loadPackage ( [ 'micropip' , 'pytest' , 'pytz' ] )
91
91
await pyodide . runPythonAsync ( python_code , { globals : pyodide . toPy ( { tests_zip} ) } )
92
+ post ( )
92
93
} catch ( err ) {
93
94
console . error ( err )
94
- const raw_error = Array . from ( new TextEncoder ( ) . encode ( err . toString ( ) ) )
95
- self . postMessage ( raw_error )
95
+ self . postMessage ( `Error: ${ err } \n` )
96
96
}
97
- post ( )
98
97
}
0 commit comments