[TIP] nose2 backwards compatibility questions
fuzzyman at voidspace.org.uk
Wed Aug 11 09:14:25 PDT 2010
On 11/08/2010 17:08, Kumar McMillan wrote:
> On Wed, Aug 11, 2010 at 9:54 AM, Michael Foord
> <fuzzyman at voidspace.org.uk> wrote:
>>> Sounds good. nose's pattern is to actually start discovery in those
>>> directories, if they are present, to ensure that if the project layout
>>> is something like:
>>> that mod is importable from tests.
>> Ok, that sounds straightforward. One question - if there is a lib/ directory
>> *and* a src/ directory do you add both to the path and continue discovery
>> into both of them - or just the first that you find?
>> In some ways allowing both is easier. :-)
> I'd rather see the developer take responsibility for putting lib and
> src dirs on their sys.path.
It isn't just a question of adding directories to sys.path - test
discovery has to happen in these directories using the right directory
as the "top level" of the project for turning paths into importable names.
The question is also one of supporting common project layouts "out of
the box", so making it controllable is one thing and the default
behaviour is another...
(I'm a big fan of tox by the way - unittest2 itself is tested with tox.)
> It's as simple as this (in Nose):
> class MyTestLayout(Plugin):
> def begin(self):
> nose.main(addplugins=[MyTestLayout()], ...)
> Furthermore, I think something like tox  encourages a much better
> practice whereby before any tests are run your module(s) under test
> are installed just like they would be in real life. You also can
> specify any external modules to install that are specific to your test
> suite (and not your production code).
>  http://codespeak.net/tox/
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
More information about the testing-in-python