Last Updated: February 25, 2016
·
3.782K
· josericardo

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:

  1. Put the test files in the tests dir.
  2. Put the test in files like class_name_test.py
  3. 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