From a012a6677b495ad44279c50594e3c6980c72dc7c Mon Sep 17 00:00:00 2001 From: Dexter Chua Date: Mon, 14 Dec 2020 16:16:13 +0800 Subject: [PATCH] Add pyodide-interrupt package (#852) --- docs/changelog.md | 3 +++ packages/pyodide-interrupts/meta.yaml | 11 +++++++++++ .../test_pyodide_interrupts.py | 17 +++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 packages/pyodide-interrupts/meta.yaml create mode 100644 packages/pyodide-interrupts/test_pyodide_interrupts.py diff --git a/docs/changelog.md b/docs/changelog.md index bab059f7c..aa1a7b72b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -27,6 +27,9 @@ - Drop support for serving .wasm files with incorrect mime type. - Replace C lz4 implementation with (upstream) javascript implementation. [#851](https://github.com/iodide-project/pyodide/pull/851) +- New package + [pyodide-interrupt](https://pypi.org/project/pyodide-interrupts/), useful for + handling interrupts in Pyodide (see project descripion for details). ## Version 0.15.0 *May 19, 2020* diff --git a/packages/pyodide-interrupts/meta.yaml b/packages/pyodide-interrupts/meta.yaml new file mode 100644 index 000000000..94f8655e9 --- /dev/null +++ b/packages/pyodide-interrupts/meta.yaml @@ -0,0 +1,11 @@ +package: + name: pyodide-interrupts + version: 0.1.1 + +source: + url: https://files.pythonhosted.org/packages/b1/c2/918c52e47bf91570d9883a1c761c4d78a59cf4d1d8f8c67c25a4e164ff87/pyodide-interrupts-0.1.1.tar.gz + sha256: b85bc38b92cd5c35dd1a5192a71495abe4cd57eadccfacbc0421fb44fb6c9e74 + +test: + imports: + - pyodide_interrupts diff --git a/packages/pyodide-interrupts/test_pyodide_interrupts.py b/packages/pyodide-interrupts/test_pyodide_interrupts.py new file mode 100644 index 000000000..f6c0e304f --- /dev/null +++ b/packages/pyodide-interrupts/test_pyodide_interrupts.py @@ -0,0 +1,17 @@ +def test_pyodide_interrupts(selenium): + selenium.load_package("pyodide-interrupts") + selenium.run("from pyodide_interrupts import check_interrupts") + assert ( + selenium.run( + "x = 0\n" + "def callback():\n" + " global x\n" + " print('check')\n" + " x += 1\n" + "with check_interrupts(callback, 10):\n" + " for i in range(50):\n" + " print(i, end=',')\n" + "x" + ) + == 11 + )