This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author eli.bendersky
Recipients eli.bendersky, ezio.melotti, ncoghlan, serhiy.storchaka
Date 2013-09-02.21:43:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1378158181.84.0.493033868957.issue18906@psf.upfronthosting.co.za>
In-reply-to
Content
A question that comes up is how should a module signal to regrtest that it needs to be run in a subprocess?

The most natural approach is to have a special attribute set in the module's global dict (for example: __REGRTEST_SUBPROCESS__ = True); however, there's a slight problem with this approach - regrtest has to import the module to see this attribute, and the module may do some work in its top-level code (commonly, imports) that already needs to be done within a subprocess.

One solution is to use a different approach, such as a separate file alongside the test file (i.e. test_foo.regrtest_subprocess alongside test_foo.py). This is quite ugly but "safe".

A different solution is to require modules that want to be executed in a subprocess to not do any top-level work; modules can already define a custom test_main function that regrtest discovers - we can require for this feature to work that modules do all their work through this function, rather than in the global scope.
History
Date User Action Args
2013-09-02 21:43:01eli.benderskysetrecipients: + eli.bendersky, ncoghlan, ezio.melotti, serhiy.storchaka
2013-09-02 21:43:01eli.benderskysetmessageid: <1378158181.84.0.493033868957.issue18906@psf.upfronthosting.co.za>
2013-09-02 21:43:01eli.benderskylinkissue18906 messages
2013-09-02 21:43:01eli.benderskycreate