Aashish P
Aashish P

Reputation: 1966

Which Python testing framework to use?

I have lots of directories in which there are python files. All are plain python files. I have not used any sort of framework for the same. I want to test those py files from one central location. I should just fire one command and all the *_test.py files from each and every directory should be invoked. So, is there any ready tool or framework available for my requirement ?

I an looking for PyUnit for testing plain py files. And thinking of writing one shell script which will invoke all these *_test.py files by using regex to match the file names.

Anyone can suggest any other approach. You are always welcome.

Thanks.

Upvotes: 4

Views: 1109

Answers (1)

ire_and_curses
ire_and_curses

Reputation: 70250

nose does all of this. Just cd to the root of your tree of Python files, and run

nosetests

Nose finds test files using a regex (basically the word test or Test present in the name):

If it looks like a test, it’s a test. Names of directories, modules, classes and functions are compared against the testMatch regular expression, and those that match are considered tests. Any class that is a unittest.TestCase subclass is also collected, so long as it is inside of a module that looks like a test.

Upvotes: 7

Related Questions