On Sun, Nov 28, 2010 at 3:12 AM, dkeeney <[email protected]> wrote:
>
> I am working on adding support for another database to Django's ORM.
>
> Is there a certain set of tests in the Django package that test the
> ORM separately from other tests?  Can anyone recommend a list of tests
> that I should ensure passing?

Well, to be completely certain, you need to run the full Django test
suite [1]; but if you're just looking for a sanity check, the
following subset:

./runtests.py --settings=<settings> aggregation basic expressions
lookup many_to_many many_to_one model_inheritance one_to_one
select_related queries

will give you a good basic coverage of all the major features of the ORM.

[1] 
http://docs.djangoproject.com/en/dev/internals/contributing/#running-the-unit-tests

> Offhand, I would expect *all* tests run from 'manage.py test' to pass
> on a brand new app with only the database configured into
> settings.py.  However, running that test suite gets many failures, and
> each is announced with a simple one-word error message line:
> 'ERROR' .  This is not how other test-runners I have used announce
> failures.

I'm not sure what you're seeing here. I deliberately introduced an
error into the test suite; this is what I get:

(django)kronkite:tests rkm$ ./runtests.py --settings=sqlite basic
Creating test database for alias 'default'...
Creating test database for alias 'other'...
.......sF..
======================================================================
FAIL: test_object_creation (modeltests.basic.tests.ModelTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/rkm/projects/django/hg/tests/modeltests/basic/tests.py",
line 417, in test_object_creation
    "<Article: Updated article 8>"])
  File "/Users/rkm/projects/django/live/django/test/testcases.py",
line 526, in assertQuerysetEqual
    return self.assertEqual(map(transform, qs), values)
AssertionError: Lists differ: ['<Article: Area man programs ... !=
['<Article: Area man programs ...

First differing element 0:
<Article: Area man programs in Python>
<Article: Area man programs in Pythonx>

- ['<Article: Area man programs in Python>',
+ ['<Article: Area man programs in Pythonx>',
?                                        +

   '<Article: Second article>',
   '<Article: Third article>',
   '<Article: Article 6>',
   '<Article: Default headline>',
   '<Article: Fourth article>',
   '<Article: Article 7>',
   '<Article: Updated article 8>']

----------------------------------------------------------------------
Ran 11 tests in 0.081s

FAILED (failures=1, skipped=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'other'...

You will sometimes get ERROR instead of FAIL on an individual test;
this indicates that the test has failed in an unexpected way, rather
than simply failing to pass an assertion. I can't think of any
circumstance where you would *only* get the text ERROR on a line.

Also - "manage.py test" only runs the tests for your specific project,
not the full set of tests for Django itself. If you want to run the
full Django test suite, you need to use runtests.py. The output of
manage.py is the same as runtests.py; but the suite of tests executed
by runtests is much larger.

Yours,
Russ Magee %-)

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

  • ORM tests dkeeney
    • Re: ORM tests Russell Keith-Magee

Reply via email to