[TIP] How do I get nose to add the cwd to sys.path?
matt at matt-good.net
Sat Nov 15 20:16:44 PST 2008
On Nov 15, 2008, at 3:57 PM, Daryl Spitzer wrote:
> On Sat, Nov 15, 2008 at 10:52 AM, jason pellerin
> <jpellerin at gmail.com> wrote:
>> Basically, python says that absolute imports are preferred, and if
>> run nosetests from inside a package (which is not really the right
>> thing to do anyway)...
> Why is that not really the right thing to do? In my case, I am
> running nosetests from inside a package because I'm adding unit tests
> to a subpackage of legacy code that currently has no unit tests. So
> to me it seems reasonable to run nosetests from the directory that
> contains the (only) "tests" subdirectory.
Restrict the set of tests to run via the command line:
nosetests --tests path/to/subdirectory/to/test
If you're in a subdirectory Nose doesn't know where the root of your
project is, so the Python path may not be set correctly. Also, if you
want to use setup.cfg to provide some default config for Nose, running
it from a subdirectory will ignore the config and not do what you
More information about the testing-in-python