Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cdleonard opened this issue Nov 6, 2013 · 2 comments
Open

Comments

@cdleonard
Copy link

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.

@thedrow
Copy link
Member

thedrow commented Nov 7, 2013

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

@jpellerin
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants