We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b0358e8 commit b6263caCopy full SHA for b6263ca
Lib/test/test_atexit.py
@@ -3,6 +3,7 @@
3
import io
4
import atexit
5
from test import support
6
+from test.support import script_helper
7
8
### helpers
9
def h1():
@@ -152,6 +153,21 @@ def test_bound_methods(self):
152
153
atexit._run_exitfuncs()
154
self.assertEqual(l, [5])
155
156
+ def test_shutdown(self):
157
+ # Actually test the shutdown mechanism in a subprocess
158
+ code = """if 1:
159
+ import atexit
160
+
161
+ def f(msg):
162
+ print(msg)
163
164
+ atexit.register(f, "one")
165
+ atexit.register(f, "two")
166
+ """
167
+ res = script_helper.assert_python_ok("-c", code)
168
+ self.assertEqual(res.out.decode().splitlines(), ["two", "one"])
169
+ self.assertFalse(res.err)
170
171
172
@support.cpython_only
173
class SubinterpreterTest(unittest.TestCase):
0 commit comments