alex/django-filter — pull request #79 by nkryptic (2013-02-19 01:41:43+00:00)
Title: major refactor of the tests, plus some cleanup

primary items about the refactor:
* moves tests package to root of project and renames it to test_django_filters
* splits tests.py into multiple files
* removes fixture need by creating instances on the fly
* attempted to use factory_boy instead, but it isn't py3k compatible yet
* uses django-discover-runner to find the test cases

while this commit focused on test refactoring, it also:
* updates runtests.py to allow more flexibility when running tests
* adds a runshell.py which configures django, runs syncdb and loads the test environment shell (in-memory sqlite db)
* adds pip requirements files for new test dependencies
* updates MANIFEST.in for test package split
* uses py3k compatible relative imports when possible
* removes XMLField handling, since we only support Django >= 1.4
* removes unnecessary code to get length on MultipleChoiceField's choices when filtering
* updates code for pep8 and pyflakes adherence
* updates the documentation about running the tests

previously, there were 44 tests for django-filter and 11 of those were duplicate runs (so, really only 33 tests). It took about 0.8 seconds to run those 33 tests. In the refactor, we have 187 tests (33 skipped and 6 expected failures) which runs in about 0.45 seconds.

I'd consider this a good start on getting all facets tested for the package. There are a few more tests to complete and there is some complex behavior which probably needs to have tests to document it, but overall I hope this will make it easier to move forward.

The biggest caveat with this is all the duplication in creating test model instances. I had originally incorporated factory_boy, but it isn't compatible with py3k and so I just expanded all the factory statements into model creation statements, but this made it much less friendly.

I would love to get everyone's feedback. I'm sure the organization of the tests could use some work, but I expect that will happen as the project evolves.