Author vstinner
Recipients miss-islington, serhiy.storchaka, shihai1991, vinay.sajip, vstinner
Date 2020-05-18.13:22:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> I think that there is no much benefit in avoiding to import modules which are imported in libregrtest.

Well, we should also enhance libregrtest in this case :-)

> You should minimize import of test.libregrtest +, not just

Good idea.

> Also, some modules, like bz2 are too small and do not have much dependencies. You will not save much on importing them lazily. On other hand, lazy import have its cost, so the real benefit will be even smaller.

FYI bz2 and lzma can me some headaches when experimenting isolated subinterpreters while I was testing modules which don't use them. bz2 and lzma are not compatible with subintepreters and so caused crashes.

IMO in an ideal world, running test_xxx should start with an empty sys.modules and only imports what it needs. The problem are also side effects, not only memory footprint.

I created this issue because test_threading crashed on AIX because of a bug at fork in the logging module. Except that test_threading and threading modules *don't* importing logging. It's non obvious to get a crash in logging while testing the threading module. For me, these are tests are no longer "unit" tests, but more "integration" tests if we test indirectly "half of the stdlib" (I exaggerate on purpose ;-)).
Date User Action Args
2020-05-18 13:22:08vstinnersetrecipients: + vstinner, vinay.sajip, serhiy.storchaka, miss-islington, shihai1991
2020-05-18 13:22:08vstinnersetmessageid: <>
2020-05-18 13:22:08vstinnerlinkissue40275 messages
2020-05-18 13:22:08vstinnercreate