thanks russ.

is it possible to make the testing-output more verbose? I tried "-v",
but that doesn´t work. It´d be nice to see what tests have been
running and what the output is (more than just "OK").

in the django-docs it says, that doctests provide automatic
documentation. what exactly does that mean? does it refer to the tests
written within the model or is it possible to generate some output
(html-file)?

concerning the django-docs:
from my point of view, the description of where to define the tests is
not easy to understand.
e.g., it says "You can put doctest strings on any object in your
models.py, but it's common practice to put application-level doctests
in the module docstring, and model-level doctests in the docstring for
each model."
whats the "module docstring"?

one more issue:
with our server-setup, it´s much easier to define a seperate user for
the test-database (instead of using the user from the production-
database). is that possible?

thanks,
patrick


On 12 Aug., 05:51, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 8/10/07, patrickk <[EMAIL PROTECTED]> wrote:
>
>
>
> > here are a couple of questions:
> > 1. where to define thetesting? in models.py or in tests.py? I´d like
> > to seperate thetestingfrom models.py, so how can I write doctests
> > in a seperate file (the example in the django documentation only
> > explains seperate unit-testing)?
>
> Django will look for doctests and unit tests in both models.py and tests.py.
>
> > 2. can I make a test-directory (and does that make sense) for all my
> > tests or do I have to use the application-directories? within
> > django_src, there´s a directory called "tests" for example.
>
> Yes, in a couple of ways.
>
> For unit tests - make a tests directory, put all your tests in that
> directory (e.g., first_test.py), then in __init__.py, put 'from
> first_test import *'.
>
> Alternatively, in tests.py, define a suite() method that constructs a
> unit test suite. See the Python documentation on building test suites
> for more details.
>
> For doctests - in tests.py, define a __test__ dictionary:
>
> from some_location import first_test_string
>
> __test__ = {
>    'first_test': first_test_string
>
> }
>
> in this context, first_test_string is a doctest string that has been
> imported from another location.
>
> These tricks are all part of standard Python doctest/unittesttesting.
> Check out the Python docs for more details. The only Django specific
> parts is the initial search - searching the models module and tests
> module of each installed application for tests.
>
> > 3. where do I find some examples (besides the django docs)?
>
> Django itself is a pretty good example. Between the modeltests,
> regression tests, and contrib app tests, Django has a very
> comprehensive test suite, that provides all sorts of detailed examples
> of how to set up and use tests.
>
> > 4. does anyone know about a simple "how-to" ontesting? something
> > like "step 1: setup thetesting-database", "step 2: create a test-
> > directory (or use the app-dir or whatever)" ... ?
>
> The steps are really just:
> - write the tests, in locations that they will be found
> - run the tests with ./manage.py test
>
> However, I'm happy to improve on any area that you think the
> documentation is inadequate. Suggestions are welcome.
>
> Yours,
> Russ Magee %-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to