4

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.

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.