Skip to content

Commit bc90e57

Browse files
committed
Fix pytest
Signed-off-by: Erik Wrede <[email protected]>
1 parent 506bb30 commit bc90e57

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

graphene_sqlalchemy/converter.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@
2828
from typing import _ForwardRef as ForwardRef
2929

3030
try:
31-
import sqlalchemy_utils as sqa_utils
31+
from sqlalchemy_utils.types.choice import EnumTypeImpl
3232
except ImportError:
33-
sqlalchemy_utils = DummyImport()
33+
EnumTypeImpl = object
3434

3535
try:
36-
from sqa_utils.types.choice import EnumTypeImpl
36+
import sqlalchemy_utils as sqa_utils
3737
except ImportError:
38-
EnumTypeImpl = object
38+
sqa_utils = DummyImport()
3939

4040
is_selectin_available = getattr(strategies, 'SelectInLoader', None)
4141

@@ -257,6 +257,8 @@ def convert_enum_to_enum(type, column, registry=None):
257257
def convert_choice_to_enum(type, column, registry=None):
258258
name = "{}_{}".format(column.table.name, column.key).upper()
259259
if isinstance(type.type_impl, EnumTypeImpl):
260+
print("AAAA")
261+
print(EnumTypeImpl)
260262
# type.choices may be Enum/IntEnum, in ChoiceType both presented as EnumMeta
261263
# do not use from_enum here because we can have more than one enum column in table
262264
return graphene.Enum(name, list((v.name, v.value) for v in type.choices))
@@ -410,7 +412,8 @@ def convert_sqlalchemy_hybrid_property_union(arg):
410412
"Please add the corresponding hybrid_property to the excluded fields in the ObjectType, "
411413
"or use an ORMField to override this behaviour.")
412414

413-
return graphene_union_for_py_union(cast(typing.List[graphene.ObjectType], list(graphene_types)), get_global_registry())
415+
return graphene_union_for_py_union(cast(typing.List[graphene.ObjectType], list(graphene_types)),
416+
get_global_registry())
414417

415418

416419
@convert_sqlalchemy_hybrid_property_type.register(lambda x: getattr(x, '__origin__', None) in [list, typing.List])

0 commit comments

Comments
 (0)