tests/misc/sys_atexit: Add test for new sys.atexit feature.
This commit is contained in:
parent
6f0c6bd774
commit
28cb15d131
18
tests/misc/sys_atexit.py
Normal file
18
tests/misc/sys_atexit.py
Normal file
@ -0,0 +1,18 @@
|
||||
# test sys.atexit() function
|
||||
|
||||
import sys
|
||||
try:
|
||||
sys.atexit
|
||||
except AttributeError:
|
||||
print('SKIP')
|
||||
raise SystemExit
|
||||
|
||||
some_var = None
|
||||
|
||||
def do_at_exit():
|
||||
print("done at exit:", some_var)
|
||||
|
||||
sys.atexit(do_at_exit)
|
||||
|
||||
some_var = "ok"
|
||||
print("done before exit")
|
2
tests/misc/sys_atexit.py.exp
Normal file
2
tests/misc/sys_atexit.py.exp
Normal file
@ -0,0 +1,2 @@
|
||||
done before exit
|
||||
done at exit: ok
|
Loading…
Reference in New Issue
Block a user