circuitpython/tests/circuitpython/atexit_test.py
microDev 1c4a6c3667
atexit module refinements
- add test for atexit module
- add callback to gc collection
- fix callback memory allocation
- execute callback on both code and repl exit
2021-08-16 21:37:32 +05:30

23 lines
382 B
Python

# test atexit module
try:
import atexit
except ImportError:
print("SKIP")
raise SystemExit
@atexit.register
def skip_at_exit():
print("skip at exit")
@atexit.register
def do_at_exit(*args, **kwargs):
print("done at exit:", args, kwargs)
atexit.unregister(skip_at_exit)
atexit.register(do_at_exit, "ok", 1, arg="2", param=(3, 4))
print("done before exit")