A
A
Alexander Savchuk2015-12-18 11:25:51
Django
Alexander Savchuk, 2015-12-18 11:25:51

How to tell Django to run tests in subdirectories?

Hello!
The project has the following structure

- project/
   - ...
   - src/
     - apps/
          - app/
             - tests/
                - __init__.py
                - test_views.py
      - static/
      - templates/

In it is __init__.pywritten
from .test_views import *
At start ./manage.py testreturns Ran 0 tests in 0.000s.
On startup ./manage.py test appeverything is ok.
How to make tests from all applications run with one command?
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
P
Pavel Karateev, 2015-12-18
@Lancelote

python manage.py --pattern="test*"

U
un1t, 2015-12-18
@un1t

You can use django_nose then you can run tests by directory or even individual classes and methods.
I switched to pytest a long time ago (+django-pytest), run like this
py.test myapp/zzz/

S
sim3x, 2015-12-18
@sim3x

https://pypi.python.org/pypi/django-discover-runner
Or set another pattern to find tests settings
or change file names from testtotests
tests_whatever.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question