views:

30

answers:

1

Is there a standard convention, or even a growing one, around where and how to invoke the tests associated with a project? In many projects, I'm seeing it bundled into a Make, a separate test.py script at the top level of the project, etc to do the work. 

I looked around for some common thing with setup.py, but didn't spot anything there (granted, I didn't look hard). What's common and best practice?

+1  A: 

The short answer is yes, there's a simple convention built-in to the unittest module. See this previous question.

Chris S
Why not this: `import x; x.test()`? Pardon the semicolon.
Hamish Grubijan
If you read my link, you'll see how the unittest module does that for you.
Chris S
So the convention is to put a test.py at the root of your project that does all the relevant imports and invokes them with unittest.main() ?
heckj
@heckj, Yes, assuming all your unittest-containing files are structured as a Python package accessible from test.py.
Chris S