Skip to content

Commit 506bb30

Browse files
committed
Add DummyImport for sqlalchemy_utils
Signed-off-by: Erik Wrede <erikwrede2@gmail.com>
1 parent 95db9f9 commit 506bb30

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

graphene_sqlalchemy/tests/test_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from graphene import Enum, List, ObjectType, Schema, String
55

66
from ..utils import (get_session, sort_argument_for_model, sort_enum_for_model,
7-
to_enum_value_name, to_type_name)
7+
to_enum_value_name, to_type_name, DummyImport)
88
from .models import Base, Editor, Pet
99

1010

@@ -99,3 +99,7 @@ class MultiplePK(Base):
9999
assert set(arg.default_value) == set(
100100
(MultiplePK.foo.name + "_asc", MultiplePK.bar.name + "_asc")
101101
)
102+
103+
def test_dummy_import():
104+
dummy_module = DummyImport()
105+
assert dummy_module.foo == object

graphene_sqlalchemy/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,9 @@ def registry_sqlalchemy_model_from_str(model_name: str) -> Optional[Any]:
206206
return next(filter(lambda x: x.__name__ == model_name, list(get_global_registry()._registry.keys())))
207207
except StopIteration:
208208
pass
209+
210+
211+
class DummyImport:
212+
"""The dummy module returns 'object' for a query for any member"""
213+
def __getattr__(self, name):
214+
return object

0 commit comments

Comments
 (0)