[Python-Dev] Testsuite dependency on _testcapi

Brett Cannon brett at python.org
Fri Mar 9 23:54:15 CET 2012


On Fri, Mar 9, 2012 at 14:44, Thomas Wouters <thomas at python.org> wrote:

>
> While testing Python 2.7 internally (at Google) I noticed that (now that
> ImportErrors aren't automatically test skips) lots of tests fail if you
> don't have the _testcapi module. These tests are (as far as I've seen)
> properly marked as cpython-only, but when some wacko decides the _testcapi
> module shouldn't, for example, be shipped to a million machines[*] that are
> never going to use it, it would be nice to still run the tests that can be
> run without _testcapi. Any objections to fixing the tests to use
> test.support.import_module() for _testcapi and a 'needs_testcapi' skipping
> decorator?
>

I have no issue with the test.support.import_module() use, although does it
really require a full-on decorator? Is there a way to make it more generic
to simply take a module name and if the import raises ImportError the test
is skipped?

-Brett


>
> To elaborate, we are also not shipping a couple of other modules (like
> distutils), but it's not unreasonable to expect those to exist (we modify
> the testsuite for that in our own builds only, instead, as well as making
> all our code deal with it.) The _testcapi module, however, is internal
> *and* meant for tests only, and used in quite a few tests (sometimes only
> in a single testfunction.)
>
> [*] 'a million machines' is not the actual number -- I don't know the
> actual number (but I'm sure it's bigger than that), I'm just tossing out
> some large number.
> --
> Thomas Wouters <thomas at python.org>
>
> Hi! I'm a .signature virus! copy me into your .signature file to help me
> spread!
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/brett%40python.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120309/a768b0df/attachment.html>


More information about the Python-Dev mailing list