-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAEBCAAGBQJUhMc7AAoJEC0ft5FqUuEh6HkP/RNXTwZkoAvG8WDjPbJO7oj+
pF0FLZQxYm1kEmISDzYanbmrRpcP95bQrnU/cnze43ZEZ9MHUdA/R3Z1Pv3+g/us
p11jR7WvkQ+pR5tGA6uwgIenxpKqAV+E5C3MXYVQi+1vFmXyqJraOrnL4tZvPPa4
O1p3wBf6t5YkQR2Yc6RNR934Pn9HJnz51SOOczXwhdR26cV1J5sd+fy8HXdti3tE
FUabmuLQNnVhi0ikhdwqQMSwHeS59g7oCbrfw8NpOVVeZDK8jzWemG5Nsz3BjTR0
6tLiz2+MOHsZnnSsGgTgsiwyZAJYQnSwD3cTR7ipW+qHL+hb1YzM0mTLeQ8RUTOd
l1tCmPhkdoiU/97PCEcq1bvyGRP0ltQKSTsHMsbW4S5oPjOnfztZWOfDKKPxROfF
zgIB0BkoiAjoPcmTWYakmWFYM9xYc1XNHbY2dON2U2hx2JyKuobl3NeNlMN6RAaF
FtmXV4ik73312epA9g/D1Y4oZyw66WE+KG7S6WPLThH903LUDUqlrkOpcIZW9Xjk
bjcL/g0ZAU0bn58ootGRoIPkRoJj8T7xinhRSq5GwZ+Nz/tZVvL4LOrMfoAEyIj9
TeMZ9SIBkRjLheIX7KFB1eof31J+01iWj3c777NZ7JUvSVbO28K6ZLnLeGH5DY2a
3AlE93NSnXFfGYdlCXGU
=lA2G
-----END PGP SIGNATURE-----
On 12/07/2014 02:28 PM, Carl Meyer wrote:
> On 12/07/2014 08:40 AM, Matwey V. Kornilov wrote:
>> I've followed this documentation:
>> https://docs.djangoproject.com/en/1.7/topics/testing/advanced/#using-the-django-test-runner-to-test-reusable-applications
>> and found that it works only for Django 1.7, whereas I would like to
>> have a code snipped working also for 1.5, 1.6.
>>
>> An issue with the runtests.py from the link above thatdjango.setup() has
>> been introduced only in 1.7 and elder version seems to require different
>> way to prepare settings object.
>
> Older Django versions didn't require any explicit initialization step,
> so all you need to do is check `hasattr(django, 'setup')` and only call
> it if it exists (or you can check the Django version instead, if you
> prefer).
>
> DiscoverRunner was only introduced in 1.6, so if you want to be
> 1.5-compatible you'll also need a fallback to the old
> DjangoTestSuiteRunner. And note that the format of test labels changed:
> in DjangoTestSuiteRunner it was an app-label, where in DiscoverRunner
> it's a full Python dotted path.
I forgot that the documented example uses django.test.utils.get_runner
instead of directly importing DiscoverRunner. `get_runner` existed
already in 1.5, so that code should work back to 1.5, I would think.
> You can see an example `runtests.py` that accounts for these differences
> here:
> https://github.com/carljm/django-model-utils/blob/master/runtests.py#L34
>
> Carl
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5484C73B.7020902%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment