[Python-ideas] Move some regrtest or test.support features into unittest?

Victor Stinner victor.stinner at gmail.com
Mon Sep 18 06:16:35 EDT 2017


Antoine:
>> * skip a test if it allocates too much memory, command line argument
>> to specify how many memory a test is allowed to allocate (ex:
>> --memlimit=2G for 2 GB of memory)
>
> That would be suitable for a plugin if unittest had a plugin
> architecture, but not as a core functionality IMO.

My hidden question is more why unittest doesn't already have a plugin
system, whereas there are tons on projects based on unittest extending
its features like pytest, nose, testtools, etc. Longer list:
https://wiki.python.org/moin/PythonTestingToolsTaxonomy

pytest has a plugin system. I didn't use it, but I know that there is
a pytest-faulthandler to enable my faulthandler module, and this
extension seems tp be used in the wild:
https://pypi.python.org/pypi/pytest-faulthandler

I found a list of pytest extensions:
https://docs.pytest.org/en/latest/plugins.html

It seems like the lack of plugin architecture prevented enhancements.

Example: "unittest: display time used by each test case"
https://bugs.python.org/issue4080

Michael Foord's comment (July, 2010): "Even if it is added to the core
it should be in the form of an extension (plugin) so please don't
update the patch until this is in place."

Victor


More information about the Python-ideas mailing list