nose2 icon indicating copy to clipboard operation
nose2 copied to clipboard

Unexpected config behavior: code-directories is relative to start-dir

Open cdleonard opened this issue 12 years ago • 2 comments

Looking inside the code (Session.prepareSysPath) it seems that "code-directories" paths are relative to the --top-level-directory. If that's not specified (and it can't seem to be specified from the config file) then it becomes relative to start-dir.

This is non-obvious and confusing (I had to read the code). It should be cleaned up somehow or at least publicly documented.

I tried to write a nose2.cfg like the following: [unittest] code-directories = lib/python start-dir = lib/python/

This looks like a way to test only one module from a directory, but it doesn't actually work. Instead I need to specify code-directories = ../

It would also be nice to warn if a code-directory is not found and won't be added to sys.path.

cdleonard avatar Nov 06 '13 22:11 cdleonard

@jpellerin Could you look at it and tell me what needs to be done?

thedrow avatar Nov 07 '13 07:11 thedrow

What I can remember off the top of my head is that this behavior was based on how unittest2.discover works. That probably means the right fix is documenting the way the various directory settings interact (especially when they are given as relative dirs). Also being able to set --top-level from the config file seems like a thing that should be possible. I don't expect to have time any time soon to look at the code and get a better answer, unfortunately.

jpellerin avatar Nov 07 '13 14:11 jpellerin