I have been using nosetests to run my python tests. However, I'm a bit stuck with my directory layout, which looks like this:
|-- src
| `-- <bunch of c++ files>
|-- python
| |-- foo
| |-- bar.py
| `-- __init__.py
`-- tests
|-- __init__.py
`-- test_bar.py
When I run nosetests -w tests from the root of the codebase, nosetest is failing to add the "python" directory to the sys.path as I would like. If I rename the "python" directory to "lib", this works fine, but is a bit of a confusing directory name, I think!
On the nose documentation the object nosetests.config.Config has the following entry:
self.srcDirs = ('lib', 'src')
I think the solution to my problem would be to set this tuple to ('python'). Ideally what I'd like to is to still run nosetests from the command line, but set the srcDirs configuration option to 'python'. Does nose allow this? I scanned through the help of nosetests and couldn't find any relevant settings. I've tried writing a configuration file nose.cfg that looks like this:
[nosetests]
srcDirs=('python')
and running nosetests -c nose.cfg -w tests, but apparently that's not a valid configuration setting. I also tried skipping nosetests and attempting my own runner, mynosetests.py:
import nose
nose.config.Config.srcDirs = ('python')
nose.main()
but apparently nose.config.Config isn't quite editable in that way! I'm sure this is possible, but I'm a little lost. Can anybody help? Thank you!