STINNER Victor <vstin...@python.org> added the comment:

Serhiy:
> 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 + test.support, not just 
> test.support.

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 ;-)).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue40275>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to