Question

I'm trying to hack my through an open source python project (namely: jinja2),

When I say "I'm hacking my way through", I mean I don't really know what I'm doing, so I want to run unittests whenever I change something to make sure I'm not breaking something major!

There's a package full of unit tests (if you want to have a look, it's here). Basically it's a folder full of python files with the name "test_xxxxxx.py"

How do I run all of these tests in one command?

Was it helpful?

Solution

It looks like Jinja uses the py.test testing tool. If so you can run all tests by just running py.test from within the tests subdirectory.

OTHER TIPS

Try to 'walk' through the directories and import all from files like "test_xxxxxx.py", then call unittest.main()

You could also take a look at nose too. It's supposed to be a py.test evolution.

Watch out for "test.py" in the Jinja2 package! -- Those are not unit tests! That is a set of utility functions for checking attributes, etc. My testing package is assuming that they are unit tests because of the name "test" -- and returning strange messages.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top