-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAEBCAAGBQJUhMaDAAoJEC0ft5FqUuEhHSEP/RENEVTu7SLssaI5pzAz1zg8
EWt0d0pSwhJHF4hsRZUrQmPFURrtBffSJ9S+Vzr2ZgC1YqeJlxplVaTbajgVTg+y
nMZBbY947wSnClCgQNuZL8t/V1/LA9URa7vEf/LXK8nrheor4DxUJra1WYJAHMU0
nSCjb3WA+yS3rGlPO62s/zBaCI3lupjWE62H1bdEwxyPmWAnegi+5Pml4a7Oz2sf
8mgzEJ3j0qfpzY+5Y+DVCZaR1FWihstFgFtXrQ65d4BN4t1Mojc6esBE3fVWJBri
O9TtcvONCIKvueesXMgBatPiWbHPcsguVM03mOG+NCllwrSWA10Z/E9DDNrGPQLX
ED4w7b5jVJmtVuh6QcHgClNorGtAjDl7Sb8YXWK/xjrdk+zDeuP7SfHpTtfPKjsP
7WjdSKtK/5KxcS4tGzga/SRzPWOatfizpd/TCybO2EXBEK4I0efLfqUpi0YxTLXR
L1XKSWimH59BsNMTA6hff4D3QCRmCrzM1htxA5XGMJFsI++68t5nUa4J+Z8dCL/W
Qu6G/sVdWKyzTtkIvY0gVezu5N17vbXwUNknKGXRsJtKtBgUuQWuLeJqZ3LNQnEI
LQmVwfoxmKYRldKPHyQbCyjuyAYJ/HjokoDFfxiwYMVigVbVjDfXML4BAZsR90F0
l8IAhHoEBdmYEf1yxRYR
=0VdN
-----END PGP SIGNATURE-----
Hi Matwey,
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.
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/5484C682.1010805%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment