[Tutor] Modules and Test Suites

Eike Welk eike.welk at gmx.net
Tue Dec 29 16:47:55 CET 2009

Hello Stephen!

On Tuesday 29 December 2009, Stephen Nelson-Smith wrote:
> I do quite a lot of programming in Ruby.  When I do so, my code
> tends to have the following layout:
> /path/to/src/my_project
> Inside my_project:
> lib/
> test/
> my_project.rb

> b) If so - how can I do it in Python?

I think the test discovery programs "py.test" and "nose" do what you 
want. If I understand you correctly you want something that sets the 
right search path for library modules. 

You could also tweak the environment variable "$PYTHONPATH" or the 
variable "sys.path".
See section 6.1.2:

I use "py.test" and like it. But I keep tests and libraries in the 
same directory. I know however that "py.test" also supports separate 
directories for tests. 


More information about the Tutor mailing list