summaryrefslogtreecommitdiff
path: root/tests/test_django.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2015-05-24 18:21:04 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2015-05-24 18:21:04 +0200
commitebc89520d3f7589da35d4e7b78637fbe7d4d664a (patch)
tree99f2d3a171444ffcf2150b89bf2355a1f70036ff /tests/test_django.py
parent6f37f9be2d2e1bc75340068911db18b2bbcbe722 (diff)
downloadfactory-boy-ebc89520d3f7589da35d4e7b78637fbe7d4d664a.tar
factory-boy-ebc89520d3f7589da35d4e7b78637fbe7d4d664a.tar.gz
Add lazy loading to factory.Iterator.
factory.Iterator no longers begins iteration of its argument on declaration, since this behavior may trigger database query when that argument is, for instance, a Django queryset. The ``factory.Iterator``'s argument will only be called when the containing ``Factory`` is first evaluated; this means that factories using ``factory.Iterator(models.MyThingy.objects.all())`` will no longer call the database at import time.
Diffstat (limited to 'tests/test_django.py')
-rw-r--r--tests/test_django.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_django.py b/tests/test_django.py
index 2cfb55c..bde8efe 100644
--- a/tests/test_django.py
+++ b/tests/test_django.py
@@ -21,6 +21,7 @@
"""Tests for factory_boy/Django interactions."""
import os
+from .compat import is_python2, unittest, mock
try:
@@ -64,7 +65,6 @@ except ImportError: # pragma: no cover
import factory
import factory.django
-from .compat import is_python2, unittest, mock
from . import testdata
from . import tools