def METHOD_NAME(self):
    # Actually test the shutdown mechanism in a subprocess
    code = """if 1:
        import atexit
        def f(msg):
            print(msg)
        atexit.register(f, "one")
        atexit.register(f, "two")
        """
    res = script_helper.assert_python_ok("-c", code)
    self.assertEqual(res.out.decode().splitlines(), ["two", "one"])
    self.assertFalse(res.err)