Making sure nose finds your Python tests
Once in a while I have to setup a new Python project and nose never finds my tests in the first run. This is a quick checklist to make sure nose can find your tests:
- Put the test files in the
tests
dir. - Put the test in files like
class_name_test.py
- Make sure your test class inherits from
unittest.TestCase
Nose does not find tests in executable files, by default, and you have to pass the --exe
flag if you want this behavior. Now you can run nosetests:
$ nosetests --exe
Written by José Ricardo
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Python
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#