summaryrefslogtreecommitdiff
path: root/factory/declarations.py
diff options
context:
space:
mode:
authornkryptic <nkryptic@gmail.com>2013-03-12 01:08:59 -0400
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2013-03-15 01:58:46 +0100
commit6c4f5846c8e21d6e48347b7e661edb72ffabb9f1 (patch)
tree966472532d500451f11a6e63ba27daa1d4d03aeb /factory/declarations.py
parent624aedf03974bedb34349d0664fb863935e99969 (diff)
downloadfactory-boy-6c4f5846c8e21d6e48347b7e661edb72ffabb9f1.tar
factory-boy-6c4f5846c8e21d6e48347b7e661edb72ffabb9f1.tar.gz
Add full Python 3 compatibility (Closes #10, #20, #49).
Also: - update travis.yml to build against 2.6-2.7 and 3.2-3.3 - Switch to relative imports Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
Diffstat (limited to 'factory/declarations.py')
-rw-r--r--factory/declarations.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/factory/declarations.py b/factory/declarations.py
index b491bfb..2b1fc05 100644
--- a/factory/declarations.py
+++ b/factory/declarations.py
@@ -25,7 +25,8 @@ import collections
import itertools
import warnings
-from factory import utils
+from . import compat
+from . import utils
class OrderedDeclaration(object):
@@ -294,7 +295,7 @@ class SubFactory(ParameteredAttribute):
self.factory_module = self.factory_name = ''
else:
# Must be a string
- if not isinstance(factory, basestring) or '.' not in factory:
+ if not isinstance(factory, compat.string_types) or '.' not in factory:
raise ValueError(
"The argument of a SubFactory must be either a class "
"or the fully qualified path to a Factory class; got "
@@ -393,7 +394,7 @@ class RelatedFactory(PostGenerationDeclaration):
self.factory_module = self.factory_name = ''
else:
# Must be a string
- if not isinstance(factory, basestring) or '.' not in factory:
+ if not isinstance(factory, compat.string_types) or '.' not in factory:
raise ValueError(
"The argument of a SubFactory must be either a class "
"or the fully qualified path to a Factory class; got "