[Django]-Django Test Runner can't find tests

13πŸ‘

βœ…

I found the issue. As suspected it was something dumb.

I was missing a __init__.py in my apps directory.

apps/
  foo/
    migrations/
    __init__.py
    admin.py
    apps.py
    models.py
    tests.py
    urls.py
    views.py
  __init__.py <-- the offender
manage.py
πŸ‘€Nathan

1πŸ‘

A couple other places to look:

  • Test filenames should start with test
  • The methods within the tests should start with test
  • If you’re using a tests directory be sure to add __init__.py to the those test folders
πŸ‘€jmunsch

0πŸ‘

Just for the record: I was having the same symptom because there was an extra __init__.py file in the project’s directory (the same directory that contains manage.py)

Applications to test were found but then I’d get an error that . could not be imported.

πŸ‘€RobM

Leave a comment