How to spread django unit tests over multiple files?

后端 未结 10 1929
后悔当初
后悔当初 2020-12-07 11:46
  • I have a python-django application
  • I\'m using the unit testing framework
  • The tests are arranged in the file \"tests.py\" in the module directory
10条回答
  •  借酒劲吻你
    2020-12-07 12:16

    I think ./manage.py test simply does running all the tests trick (in django >= 1.7).

    If your organizing tests is about grouping and cherrypicking and you are fan of nose use django nose:

    python manage.py test another.test:TestCase.test_method
    

    If you know nose, then you know how to "wildcard" much nicer over all your files.

    PS

    It is just a better practice. Hope that helps. The answer was borrowed from here: Running a specific test case in Django when your app has a tests directory

提交回复
热议问题