Skip to content

Commit

Permalink
Updated script
Browse files Browse the repository at this point in the history
  • Loading branch information
andeplane committed Jun 10, 2024
1 parent d579755 commit 2e8b90f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/test-pyodide.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Description: This script is used to test the Python SDK installation in a Pyodide environment.
// We are using JupyterLite and stlite, both pyodide based Python runtimes. To ensure that the SDK works
// in these runtimes, we need to test the installation of the SDK in a Pyodide environment.
// This script will start an HTTP server to serve the SDK wheel file and then try to install the SDK in Python.
// If the installation is successful, it will run a simple Python script to test the SDK.
const { loadPyodide } = require("pyodide");

const http = require('http');
Expand Down Expand Up @@ -40,11 +45,11 @@ server.listen(PORT, () => {
}
await pyodide.runPythonAsync("from cognite.client import CogniteClient");

return pyodide.runPythonAsync("1+1");
return pyodide.runPythonAsync("Python SDK successfully installed and imported!");
}

test_cognite_sdk().then((result) => {
console.log("Python says that 1+1 =", result);
console.log("Response from Python =", result);
server.close();
});
});

0 comments on commit 2e8b90f

Please sign in to comment.