[Solved]-Can I run django tests (manage.py) from a different directory?


Late in answering this question. But hope this helps someone:

python <project_path>/manage.py test <your_project_dir>

Running Django tests from another directory

From Django documentation:

You can also provide a path to a directory to discover tests below that directory:

$ ./manage.py test animals/


  1. https://docs.djangoproject.com/en/dev/topics/testing/overview/#running-tests
  2. https://docs.python.org/3/library/unittest.html#test-discovery


Based on the comments from @dizballanze and feedback from review of the code, I wound up doing this:

(cd /somedir && python manage.py test)

I’m still curious as to whether it’s possible to run the tests without cding into the root directory of the project, though.

Leave a comment