#2333: Add unit test framework for end-user Django applications
---------------------------------+------------------------------------------
Reporter: russellm | Owner: russellm
Status: new | Component: Unit test system
Version: SVN | Resolution:
Keywords: unit test doctest | Stage: Design decision needed
Has_patch: 1 | Needs_docs: 1
Needs_tests: 0 | Needs_better_patch: 1
---------------------------------+------------------------------------------
Comment (by russellm):
I've just attached a revised Fixtures patch for public consideration.
The shape of this patch has been shaped by the discussion I have had with
Jacob and others on the django-dev mailing list.
Noteworthy changes since the last version:
* ``manage.py`` has ``loaddata``, ``dumpdata`` and ``flush`` targets to
load fixtures, dump fixtures, and flush the contents of the database,
respectively.
* ``manage.py loaddata foo.json`` will look for JSON fixtures named
``foo`` in the application fixture directories, the directories named in
``FIXTURE_DIRS``, and in the absolute path (i.e., ``loaddata
/bar/whiz/foo.json`` will load the specifically named file).
* ``manage.py loaddata foo`` will look for any fixture type named
``foo``; if foo.xml and foo.json are found in the same fixture directory,
an error is raised, and the fixture installation is rolled back.
* ``manage.py install`` has been removed in favour of ``syncdb``; the
'pass sqlall into the database' approach misses all the signals and
indexing that syncdb performs, retrofitting ``install`` to have these
features would be non-trivial, and ultimately would yield nothing more
than a subset of the functionality of ``syncdb``
* ``manage.py sqlinitialdata`` has been deprecated, with a message
directing to the new name ``sqlcustom``. This is a rename to indicate that
initial data should not be in SQL format, but in the new fixtures format.
* The django.test.TestCase unit test base class is used as follows:
{{{
class MyTest(django.test.TestCase):
fixtures = 'foo', 'bar.json', 'whiz.xml'
def test_features(self):
pass
}}}
Fixture lookup follows the same pattern as loaddata.
The only open issue at this point is database backend compatibility.
SQLite, MySQL, and Postgres 8.1+ are covered. Oracle _should_ work AFAIK,
but is untested. ADO is completely untested. Postgres 7.x and 8.0 will not
work. The only effect of this patch on unsupported databases is that
fixtures wont work, and the fixture-based unit tests fail.
Documentation will be forthcoming once this final design has been
approved.
--
Ticket URL: <http://code.djangoproject.com/ticket/2333#comment:32>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---