[wingide-users] Relative paths in custom PYTHONPATH don't work
with nose tests
Wingware Support
support at wingware.com
Sun Sep 21 10:52:33 MDT 2008
Torsten Marek wrote:
> when setting relative paths in the project PYTHONPATH, my nose tests do
> not find the project packages any more.
>
> My project layout is as follows:
>
> project/
> PKG/ # the main package
> util/ # sub-packages
> stuff.py
> ...
> tests/
> util/ # tests for classes in PKG.util
> test_stuff.py
> ...
>
> When I try to run test_stuff.py, I get ImportErrors trying to import
> PKG.util.stuff.
What you're seeing is the affect of the current working directory being
different when tests are run versus when the main debug file is run. By
default, the initial current working directory is the directory that the
file run in in -- this applies to either the main debug file or the
individual test files.
There's a couple of workarounds (at least):
* Set an environment variable and use that when setting your project
directory
* Set the project wide initial directory to a custom value.
These do require a change to the project settings for each branch. We
do plan to make it possible to eliminate this step in the future.
Cheers,
John
More information about the wingide-users
mailing list