Advice on how to split newform tests

2 views
Skip to first unread message

Leo Soto M.

unread,
Sep 19, 2007, 2:18:16 PM9/19/07
to django-d...@googlegroups.com
I'm working on the splitting of the beasts residing on
tests/regressiontests/forms. Motivations: They (tests.py and
localflavors.py) are too big for human consumption. And for Jython
consumption too (strings constants can't be longer than 32Kbytes).

I've already splitted localflavors into one file per flavor. It also
got its own regressiontests/forms/localflavor directory to avoid
cluttering the regressiontests/forms/.

But I'm not that satisfied with the result, as I ended with the
following on regressiontests/forms/tests.py:

from localflavor.is_ import tests as localflavor_is_tests
from localflavor.ar import tests as localflavor_ar_tests
from localflavor.pl import tests as localflavor_pl_tests
from localflavor.fr import tests as localflavor_fr_tests
from localflavor.ch import tests as localflavor_ch_tests
from localflavor.cl import tests as localflavor_cl_tests
from localflavor.br import tests as localflavor_br_tests
from localflavor.it import tests as localflavor_it_tests
from localflavor.nl import tests as localflavor_nl_tests
from localflavor.au import tests as localflavor_au_tests
from localflavor.fi import tests as localflavor_fi_tests
from localflavor.jp import tests as localflavor_jp_tests
from localflavor.sk import tests as localflavor_sk_tests
from localflavor.uk import tests as localflavor_uk_tests
from localflavor.generic import tests as localflavor_generic_tests
from localflavor.us import tests as localflavor_us_tests
from localflavor.ca import tests as localflavor_ca_tests
from localflavor.de import tests as localflavor_de_tests

[snip]

__test__ = {
'form_tests': form_tests,
'localflavor_is_tests': localflavor_is_tests
'localflavor_ar_tests': localflavor_ar_tests
'localflavor_pl_tests': localflavor_pl_tests
'localflavor_fr_tests': localflavor_fr_tests
'localflavor_ch_tests': localflavor_ch_tests
'localflavor_cl_tests': localflavor_cl_tests
'localflavor_br_tests': localflavor_br_tests
'localflavor_it_tests': localflavor_it_tests
'localflavor_nl_tests': localflavor_nl_tests
'localflavor_au_tests': localflavor_au_tests
'localflavor_fi_tests': localflavor_fi_tests
'localflavor_jp_tests': localflavor_jp_tests
'localflavor_sk_tests': localflavor_sk_tests
'localflavor_uk_tests': localflavor_uk_tests
'localflavor_generic_tests': localflavor_generic_tests
'localflavor_us_tests': localflavor_us_tests
'localflavor_ca_tests': localflavor_ca_tests
'localflavor_de_tests': localflavor_de_tests
'regressions': regression_tests,
'util_tests': util_tests,
}

It cries for test autodiscovering, IMHO.

So, these are my options:

a) Continue the splitting before someone touches this tests.
b) Implement adhoc autodiscovering on forms/tests.py.
c) Dive into the django test infraestructure to fix it in the Right Way.
d) I'm missing something.

I'm for (a) followed by (c). That is, the split will leave this
unpleasant code on regressiontests/forms/tests.py, but it would be
better than the current situation anyway. Later, I can tackle the
autodiscovering if it's worth the effort. But I'm open to hear that
(d) is correct and everything is easier than it seems.

Thoughts?
--
Leo Soto M.

Leo Soto M.

unread,
Sep 19, 2007, 7:28:09 PM9/19/07
to django-d...@googlegroups.com
On 9/19/07, Leo Soto M. <leo....@gmail.com> wrote:
> I'm working on the splitting [...]

Well, I did it, see: http://code.djangoproject.com/ticket/5546

Please, if someone is currently working on such tests, ping me so I
can update the split version and post another patch. Or wait a bit for
this to be applied ;-), if no objection is raised.

--
Leo Soto M.

Jacob Kaplan-Moss

unread,
Sep 19, 2007, 7:42:02 PM9/19/07
to django-d...@googlegroups.com
On 9/19/07, Leo Soto M. <leo....@gmail.com> wrote:
> Well, I did it, see: http://code.djangoproject.com/ticket/5546

Committed in [6379] -- thanks a bunch for the grunt work. The length
of that file was starting to annoy me :)

Oh, and I agree that these sub-tests ought to be autodiscovered, but I
didn't want to block a good improvement on a "wouldn't it be nice"
feature.

Jacob

Leo Soto M.

unread,
Sep 19, 2007, 8:17:53 PM9/19/07
to django-d...@googlegroups.com
On 9/19/07, Jacob Kaplan-Moss <jacob.ka...@gmail.com> wrote:
>
> On 9/19/07, Leo Soto M. <leo....@gmail.com> wrote:
> > Well, I did it, see: http://code.djangoproject.com/ticket/5546
>
> Committed in [6379] -- thanks a bunch for the grunt work. The length
> of that file was starting to annoy me :)

Jacob, thanks for the quick response!

It seems that the diff format isn't the best way to comunicate file
deletions: regressiontests/forms/localflavor.py should be removed, but
it's still alive on SVN, without any content.

--
Leo Soto M.

Jacob Kaplan-Moss

unread,
Sep 19, 2007, 8:25:12 PM9/19/07
to django-d...@googlegroups.com
On 9/19/07, Leo Soto M. <leo....@gmail.com> wrote:
> It seems that the diff format isn't the best way to comunicate file
> deletions: regressiontests/forms/localflavor.py should be removed, but
> it's still alive on SVN, without any content.

Whoops, deleted, thanks.

Jacob

Reply all
Reply to author
Forward
0 new messages