summaryrefslogtreecommitdiffstatshomepage
path: root/tests/extmod/asyncio_as_uasyncio.py
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2023-06-08 16:42:19 +1000
committerDamien George <damien@micropython.org>2023-06-19 18:37:34 +1000
commitca79b4961953be587a290bc995ae925e664c9fbc (patch)
tree798616c8c5fdf50390f48e942befdd4b5520f588 /tests/extmod/asyncio_as_uasyncio.py
parent7979a4d26776330a89166fa60c917475579f7dd8 (diff)
downloadmicropython-ca79b4961953be587a290bc995ae925e664c9fbc.tar.gz
micropython-ca79b4961953be587a290bc995ae925e664c9fbc.zip
extmod/asyncio/uasyncio.py: Add backwards-compatible uasyncio alias.
This allows existing code that does `import uasyncio` or `import uasyncio as asyncio` to continue working. It uses the same lazy-loading as asyncio to prevent loading of unused features. This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/extmod/asyncio_as_uasyncio.py')
-rw-r--r--tests/extmod/asyncio_as_uasyncio.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/extmod/asyncio_as_uasyncio.py b/tests/extmod/asyncio_as_uasyncio.py
new file mode 100644
index 0000000000..612292299c
--- /dev/null
+++ b/tests/extmod/asyncio_as_uasyncio.py
@@ -0,0 +1,12 @@
+try:
+ import uasyncio
+ import asyncio
+except ImportError:
+ print("SKIP")
+ raise SystemExit
+
+x = set(dir(uasyncio))
+y = set(dir(asyncio)) - set(["event", "lock", "stream", "funcs"])
+
+print(x - y)
+print(y - x)