Pytest - no tests ran

According to the pytest test conventions, your class should start with Test to be automatically picked up by the test discovery mechanism. Call it TestRegisterNewInstructor instead.

Or, subclass the unittest.TestCase:

import unittest

class RegisterNewInstructor(unittest.TestCase):
    # ...

Also keep in mind that the .py test script itself must begin with test_ or end with _test in its filename.


As simple as it looks:

  1. Make sure that your file name matches the pattern: test_*.py or *_test.py.
  2. Make sure that your function name starts with the test prefix.

Find more about the pytest conventions here.