[TIP] Coming changes to unittest2 plugins

Tarek Ziadé ziade.tarek at gmail.com
Mon Sep 27 14:02:48 PDT 2010

On Mon, Sep 27, 2010 at 8:33 PM, holger krekel <holger at merlinux.eu> wrote:
>> 1/ the new import system will be simpler, and we will be able to
>> switch to it at some point. We just have to live with __import__ for
>> the time being. And even if it's a bit weird, it works.
> Pardon my ignorance - which "new import system" do you refer to?

importlib written by Bret

>> 2/ I'd like to see any error we would be unable to solve.
> Not sure what you mean with that.  Almost any errors can be solved.
> Above I rather referred to error messages ... for example if you do:
>    >>> distutils2.util.resolve_name("unittest2.plugins.filtertests.FilterTest")
>    Traceback (most recent call last):
>      File "<stdin>", line 1, in <module>
>      File "/home/hpk/venv/0/lib/python2.6/site-packages/distutils2/util.py", line
>    664, in resolve_name
>        raise ImportError
>    ImportError
>    >>>

This is really easy to improve since the function can tell you exactly
where it failed.

>> 3/ For this specific work there's no need to make the call
>> performant/fast since the location is loaded once.
> My concern is static analysability not performance.
> Summary of my POV: i think there are good reasons to use specifications
> like "x.y:ABC" in .ini or .cfg files instead of the seemingly nicer "x.y.ABC"
> because the latter is ambigous and needs more information and/or calls into the
> import system to extract the meaning of the dotted names.  The fact that is is
> possible to extract the information or that the latter is a valid Python
> expression does not per-se make it a better specification IMHO.

The ambiguity is not really in the notation but in the usage we do of
that information.

Basically you are saying that is ambiguous because it's not easy to
convert back to the old format.
But it seems that you don't have any practical use case for the colon
notation other that staying compatible with Setuptools.

So, I have a proposal: if I write the function that reverts x.y.ABC to
x.y.ABC for your setuptools compat code,
will you agree on the dotted notation ?

> cheers,
> holger

Tarek Ziadé | http://ziade.org

More information about the testing-in-python mailing list