[Django]-Django testing external script

3👍

I would suggest to use a different test runner.

You can do pip install django-nose and then set the following setting in your test_settings.py

TEST_RUNNER = `django_nose.NoseTestSuiteRunner`

Now you can run the tests with

./manage.py test --settings=yourproject.test_settings.py 

and the Nose testrunner will search all subfolders for folders called tests and in those folders it will search for files that end with _tests.py (and in those files it will search for classes that derive from TestCase, as usual).

So your project structure should look something like this:

- Project-Root/
  - Your-Non-App-Code/
    - __init__.py
    - non_app_code.py
    - tests/
      - __init__.py
      - non_app_code_tests.py

For more info on how to install django-nose, check their Github repo: https://github.com/django-nose/django-nose

Leave a comment