Monday, October 3, 2016

Re: Testing a reusable app which uses a database

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJX8rWZAAoJEC0ft5FqUuEhs6IP/igPrB8HVGy8DAaFI5sYTZmo
1prfu8Tu7eXXmxsHFwrGHHNxm+PjtY/nYuczHTYZ1LMqnjGFv/ODOD7MYlgqwSkk
wFlg5GS8Ip+RR1uRpkoQYizbBUva+TV+APK5HBv6dNEvzyunHp4+qYMRGUViw1wI
/hIQvthkf1nCyX6jgj0xGwmrvUffPfzs+QhN8EcAy27E3up7ANTTXn3jCPtboA29
1P1zTJMG/woPGHqQRqJoJxDp7RqGn0zLKx6jD8gCEQJptkxlH+SP3lqowSWNe7ZN
p4dRqD7dz1T2HVIq7lhlRzFh29q68ZqyApx0bAKRlJkqhjAhEO5a/DjJ3HXEUthT
Os2KU1FJhOBBPaT1/n6ftWkBl6b8NadV5LpRj74zrnYkDRzucKWc8Qo8F3T6uXxu
cWHaqAbsDNaBYWZRLNgWGOCCbGkFBoXLZVJow+2IbcZF1PXfeNRnzHMqb9dySzbD
57+KNqaBUgYkw97EoJRaHw8y/4o1kRe0C6Scd6wJEDHYAWP+1OOVPNpzfqegHw0H
yDq+rPXxdIHYbTlKA6NT/sinhJD8q6HADXCnw0KkIMH8GCvOzfCCGi6Y17eUrpk5
f+joQ7MVwoWt/DNn8Cl5m6r9+WM5HOaOdSJUMRrNXZnHJ3WdwGAD9zpeZd/2d/uf
YxVMbF2vAclpcAEWEVuo
=yrDT
-----END PGP SIGNATURE-----
On 10/03/2016 01:41 PM, Victor Porton wrote:
> I try to make a reusable app which uses transaction.atomic().
>
> When I run my test.py (below) for my reusable app, I get the below errors.
>
> Is it possible to test this reusable app outside of a Django project?

It is not possible to test it without setting up Django, no. But you
don't need a full-fledged "project" for this, the bare minimum you need
to do is

import django
from django.conf import settings

settings.configure() # if you need any settings, pass as a dict
django.setup()

before running your tests.

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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0c2f6add-3aab-cb11-981e-3147e203a12a%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment