Ticket #6134: testdocu.patch

File testdocu.patch, 3.7 KB (added by jdetaeye, 17 years ago)

Documentation patch

  • docs/settings.txt

     
    981981
    982982Default: ``None``
    983983
    984 The name of database to use when running the test suite. If a value of
    985 ``None`` is specified, the test database will use the name ``'test_' + settings.DATABASE_NAME``. See `Testing Django Applications`_.
     984The name of database to use when running the test suite.
     985If a value of ``None`` is specified and the SQLite database engine is used the
     986tests will use a memory resident database. For all other database engines the test
     987database will use the name ``'test_' + settings.DATABASE_NAME``.
     988See `Testing Django Applications`_.
    986989
    987990.. _Testing Django Applications: ../testing/
    988991
  • docs/testing.txt

     
    270270
    271271    $ ./manage.py test animals.AnimalTestCase.testFluffyAnimals
    272272
    273 Understanding the test output
    274 -----------------------------
     273The test database
     274-----------------
    275275
    276 When you run your tests, you'll see a number of messages as the test runner
    277 prepares itself::
     276Tests that require a database (namely, model tests) will not use
     277your "real" (production) database. A separate, blank database is created
     278for the tests.
    278279
    279     Creating test database...
    280     Creating table myapp_animal
    281     Creating table myapp_mineral
    282     Loading 'initial_data' fixtures...
    283     No fixtures found.
     280Regardless of whether the tests pass or fail, the test database is destroyed when
     281all the tests have been executed.
    284282
    285 This tells you that the test runner is creating a test database -- a blank,
    286 from-scratch database that it will use for any tests that happen to require a
    287 database (namely, model tests).
     283By default this test database gets its name by prepending ``test_`` to the value
     284of the ``DATABASE_NAME`` setting. When using the SQLite database engine the tests
     285will by default use a memory resident database (i.e. ``:memory:``).
     286If you want to use a different database name, specify the ``TEST_DATABASE_NAME``
     287setting.
    288288
    289 Don't worry -- the test runner will not touch your "real" (production)
    290 database. It creates a separate database purely for the tests. This test
    291 database gets its name by prepending ``test_`` to the value of the
    292 ``DATABASE_NAME`` setting. If you want to use a different name, specify the
    293 ``TEST_DATABASE_NAME`` setting.
    294 
    295289Aside from using a separate database, the test runner will otherwise use all of
    296290the same database settings you have in your settings file: ``DATABASE_ENGINE``,
    297291``DATABASE_USER``, ``DATABASE_HOST``, etc. The test database is created by the
     
    306300
    307301.. _settings: ../settings/
    308302
     303Understanding the test output
     304-----------------------------
     305
     306When you run your tests, you'll see a number of messages as the test runner
     307prepares itself. You can control the level of detail of these messages with the
     308``verbosity`` option on the command line::
     309
     310    Creating test database...
     311    Creating table myapp_animal
     312    Creating table myapp_mineral
     313    Loading 'initial_data' fixtures...
     314    No fixtures found.
     315
     316This tells you that the test runner is creating a test database, as described
     317in the previous section.
     318
    309319Once the test database has been created, Django will run your tests.
    310320If everything goes well, you'll see something like this::
    311321
     
    349359feature is useful if you're using the test-runner script in a shell script and
    350360need to test for success or failure at that level.
    351361
    352 Regardless of whether the tests pass or fail, the test database is destroyed when
    353 all the tests have been executed.
    354 
    355362Testing tools
    356363=============
    357364
Back to Top