Sha256: fe9aef655ae10646e2d5afa05a102f04fcb4e36e47fc2976d53ac695e0982754

Contents?: true

Size: 1.01 KB

Versions: 30

Compression:

Stored size: 1.01 KB

Contents

# Test the atexit module.
from test_support import TESTFN, vereq, is_jython
import atexit
from os import popen, unlink
import sys

executable = sys.executable
if is_jython:
    executable = "jython"

input = """\
import atexit

def handler1():
    print "handler1"

def handler2(*args, **kargs):
    print "handler2", args, kargs

atexit.register(handler1)
atexit.register(handler2)
atexit.register(handler2, 7, kw="abc")
"""

fname = TESTFN + ".py"
f = file(fname, "w")
f.write(input)
f.close()

p = popen("%s %s" % (executable, fname))
output = p.read()
p.close()
vereq(output, """\
handler2 (7,) {'kw': 'abc'}
handler2 () {}
handler1
""")

input = """\
def direct():
    print "direct exit"

import sys
sys.exitfunc = direct

# Make sure atexit doesn't drop
def indirect():
    print "indirect exit"

import atexit
atexit.register(indirect)
"""

f = file(fname, "w")
f.write(input)
f.close()

p = popen("%s %s" % (executable, fname))
output = p.read()
p.close()
vereq(output, """\
indirect exit
direct exit
""")

unlink(fname)

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
rubyfox-server-2.19.2.0 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.17.3.2 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.17.3.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.17.3.0 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.3.2 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.3.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.0.4 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.0.3 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.0.2 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.0.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.16.0.0 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.7.3 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.6.2 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.6.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.5.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.4.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.13.3.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.12.5.1 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.12.5.0 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py
rubyfox-server-2.12.4.0 lib/rubyfox/server/data/lib/Lib/test/test_atexit.py