[TIP] How do I get nose to add the cwd to sys.path?
kumar.mcmillan at gmail.com
Thu Nov 13 14:16:08 PST 2008
On Thu, Nov 13, 2008 at 3:49 PM, Daryl Spitzer <daryl.spitzer at gmail.com> wrote:
> When I run `nosetests` it finds the tests in the .py files in tests/,
> but I get an import error in the tests when they try to import the
> module they're testing (which is in the parent directory of the tests
> in "tests"). I've tried `nosetests -w .` (and other variants) but I
> get the same import errors.
> if not os.getcwd() in sys.path:
This is pretty much what nose does for you so. Your use case is very
common and should work just fine with default options. How is your
test directory structure laid out? Do you use __init__py files in
your test directories?
You *could* try nosetests --no-path-adjustment but path adjustment is
usually there to make things work how you'd expect. btw, you could
also try the nose users list.
More information about the testing-in-python