Sunday, December 7, 2014

Re: Testing reusable application: compatible way


The following code works perfect for me, why the code in the documentations so sophisticated?

def runtests():
        os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.test_settings")

        try:
                from django import setup
                setup()
        except ImportError:
                pass
        from django.core.management import call_command

        call_command("test","tests.__init__")

if __name__ == "__main__":
        runtests()


воскресенье, 7 декабря 2014 г., 18:40:42 UTC+3 пользователь Matwey V. Kornilov написал:
Hi,

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 that django.setup() has been introduced only in 1.7 and elder version seems to require different way to prepare settings object.

--
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/3e14ba33-4d84-4d16-afc0-aa02b6b9ce09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment