0

I have a project that shares a database among many wsgi apps (sites framework from contrib is in heavy use). Each wsgi app has it's own module in project dir with it's own settings.py that extend global_settings.py in main project dir (each settings file simply imports * from global_settings). Also some sites have their own urls and extra views/templates that cannot be tested globally. All the sites share most apps though. Also due to customisations of views (subclassed cbl views) I need to test each site separately. Django expects tests.py only in app dirs so I can't issue:

./manage.py test first_site --settings=first_site.settings

since first_site is just a python module not a django app. How can I overcome this?

4

2 に答える 2

0

私はこれを見つけました: http://pypi.python.org/pypi/django-discover-runner

django-discover-runner をインストールした後 (たとえば pip で):

pip install -U django-discover-runner

カスタム サイト設定に 1 行追加するだけです。

TEST_RUNNER = 'discover_runner.DiscoverRunner'

このコマンドは、呼び出された通常の python モジュールからテストを実行しますfirst_site

./manage.py test first_site --settings=first_site.settings

スジは通ってるようだ。

于 2012-09-23T18:08:13.153 に答える