Closed mx-moth closed 8 years ago
This looks good. Since we're now testing against Django 1.9 and 1.10, let's add a test matrix into Travis to test both versions.
For some reason the tests have not run against the correct commit. They do work though.
OK, got the tests working finally. I had to make some changes to get it all being happy.
tox
is now used to test the different versions. This is cleaner and more standard than making a giant travis.yml
. It also means all the tests can be run locally.tests_require
had to be dropped from setup.py
, as it does not work with -e git+
urls. As tests_require
are not actually used by anything, this should not be a huge loss.tox
tasks. The upside is they only run once, instead of for every environment as they were when run through Travis. The down side is that if pep8
fails, pylint
and isort
will not run. There are some ways of making them run, but they are not great ways.
Tests for the CompositeTypeField have been added. Tests for the CompositeTypeWidget are not included in this PR.
A few changes were made along the way, to make the forms API nicer and to support testing:
CompositeTypeField.__init__
generates fields from a CompositeType, instead ofBaseField.formfield
. This makes usingCompositeTypeField
s much easier, as developers only have to supply a model, and everything else will be done for them.CompositeType.__eq__
has been added. It compares things field-by-field. Required for the tests, but also a good idea to have.CompositeType
without aMeta
made no sense, asMeta.db_field
is required. Better error messages have been added for the case of a missingCompositeType.Meta
class. This is unrelated to adding tests for forms, but I came across the error because of Nose and TestModel / TestType naming. This helped me debug and will probably help others as well.ValidationError
s caught. Any errors are then raised as a group. Previously, only the error from the first invalid subfield was raised.