93

Django のmanage.py testコマンドを使用してテストの実行が終了すると、合格したテストの数だけがコンソールに出力されます。

(virtualenv) G:\Project\>python manage.py test
Creating test database for alias 'default'...
True
..
----------------------------------------------------------------------
Ran 2 tests in 0.017s

OK
Destroying test database for alias 'default'...

見る方法はありますか:

  1. 実際に実行されたテスト
  2. どのモジュールから
  3. どのような順序で

ドキュメントで解決策が見つかりませんでした。

4

2 に答える 2

153

コマンドに渡すことができ-v 2ますtest

python manage.py test -v 2

このコマンドを実行すると、次のような結果が得られます (私は django 2 を使用しています。移行やデータベースに関するものは無視してかまいません)。

Creating test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Operations to perform:
  Synchronize unmigrated apps: messages, staticfiles
  Apply all migrations: admin, auth, contenttypes, sessions
Synchronizing apps without migrations:
  Creating tables...
   Running deferred SQL...
Running migrations:
  Applying contenttypes.0001_initial... OK
  ...
  Applying sessions.0001_initial... OK
System check identified no issues (0 silenced).
test_equal_hard (polls.tests.TestHard) ... ok      <--------+
test_equal_simple (polls.tests.TestSimple) ... ok  <--------+
                                                            |
                                                            |
           That's your tests!  >----------------------------+

ちなみに、vは冗長性を表します ( も使用できます--verbosity=2):

python manage.py test --verbosity=2

からの抜粋は次のpython manage.py test --helpとおりです。

-v {0,1,2,3}, --verbosity {0,1,2,3}

詳細レベル。0=最小限の出力、1=通常の出力、2=詳細な出力、3=非常に詳細な出力

于 2014-02-01T16:16:30.403 に答える