[Distutils] [issue147] "test" command breaks 'atexit' handlers
setuptools at bugs.python.org
Thu Jan 3 06:29:34 CET 2013
New submission from Brian Lauber:
I wrote a module that registers an "atexit" handler. However, when I executed the unit tests for this module via setuptools, the "atexit" handler would never be invoked:
python ./setup.py test
The root cause of the issue is that fact that setuptool's "test" command un-loads modules between each test run. This means that the 'atexit' module is unavailable when Python exits, which means that the callbacks are never invoked.
It is possible to prevent setuptools from un-loading the 'atexit' module by importing 'atexit' at the beginning of the setup.py file. This allows the 'atexit' handlers to run, but they ultimately fail because all of the modules have already been unloaded.
You can find a more complete write-up on the issue here:
title: "test" command breaks 'atexit' handlers
Setuptools tracker <setuptools at bugs.python.org>
More information about the Distutils-SIG