back to SWE-Agent summary
SWE-Agent: graphene
Pytest Summary for test graphene
status |
count |
error |
5 |
total |
5 |
collected |
5 |
passed |
0 |
Failed pytests:
test_orderedtype.py::test_orderedtype
test_orderedtype.py::test_orderedtype
name = 'graphene', package = None
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
level = 0
if name.startswith('.'):
if not package:
msg = ("the 'package' argument is required to perform a relative "
"import for {!r}")
raise TypeError(msg.format(name))
for character in name:
if character != '.':
break
level += 1
> return _bootstrap._gcd_import(name[level:], package, level)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/__init__.py:2: in
from .relay import (
graphene/relay/__init__.py:1: in
from .node import Node, is_node, GlobalID
graphene/relay/node.py:3: in
from ..types import Field, Interface, ObjectType
graphene/types/__init__.py:4: in
from .argument import Argument
graphene/types/argument.py:5: in
from .structures import NonNull
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from .unmountedtype import UnmountedType
> from .utils import get_type
E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
graphene/types/structures.py:2: ImportError
The above exception was the direct cause of the following exception:
cls =
func = . at 0x7f97928faa20>
when = 'setup'
reraise = (, )
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
.venv/lib/python3.11/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/_pytest/runner.py:242: in
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:70: in unraisable_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/logging.py:840: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
.venv/lib/python3.11/site-packages/_pytest/logging.py:829: in _runtest_for
yield
.venv/lib/python3.11/site-packages/_pytest/capture.py:875: in pytest_runtest_setup
return (yield)
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/runner.py:160: in pytest_runtest_setup
item.session._setupstate.setup(item)
.venv/lib/python3.11/site-packages/_pytest/runner.py:514: in setup
col.setup()
.venv/lib/python3.11/site-packages/_pytest/python.py:663: in setup
init_mod = importtestmodule(self.path / "__init__.py", self.config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = PosixPath('/testbed/graphene/__init__.py')
config = <_pytest.config.Config object at 0x7f9793341190>
def importtestmodule(
path: Path,
config: Config,
):
# We assume we are only called once per module.
importmode = config.getoption("--import-mode")
try:
mod = import_path(
path,
mode=importmode,
root=config.rootpath,
consider_namespace_packages=config.getini("consider_namespace_packages"),
)
except SyntaxError as e:
raise nodes.Collector.CollectError(
ExceptionInfo.from_current().getrepr(style="short")
) from e
except ImportPathMismatchError as e:
raise nodes.Collector.CollectError(
"import file mismatch:\n"
"imported module {!r} has this __file__ attribute:\n"
" {}\n"
"which is not the same as the test file we want to collect:\n"
" {}\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules".format(*e.args)
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.get_verbosity() < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = str(exc_repr)
> raise nodes.Collector.CollectError(
f"ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
f"{formatted_tb}"
) from e
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/testbed/graphene/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E /root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126: in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E graphene/__init__.py:2: in
E from .relay import (
E graphene/relay/__init__.py:1: in
E from .node import Node, is_node, GlobalID
E graphene/relay/node.py:3: in
E from ..types import Field, Interface, ObjectType
E graphene/types/__init__.py:4: in
E from .argument import Argument
E graphene/types/argument.py:5: in
E from .structures import NonNull
E graphene/types/structures.py:2: in
E from .utils import get_type
E E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
.venv/lib/python3.11/site-packages/_pytest/python.py:523: CollectError
test_orderedtype.py::test_orderedtype_eq
test_orderedtype.py::test_orderedtype_eq
name = 'graphene', package = None
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
level = 0
if name.startswith('.'):
if not package:
msg = ("the 'package' argument is required to perform a relative "
"import for {!r}")
raise TypeError(msg.format(name))
for character in name:
if character != '.':
break
level += 1
> return _bootstrap._gcd_import(name[level:], package, level)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/__init__.py:2: in
from .relay import (
graphene/relay/__init__.py:1: in
from .node import Node, is_node, GlobalID
graphene/relay/node.py:3: in
from ..types import Field, Interface, ObjectType
graphene/types/__init__.py:4: in
from .argument import Argument
graphene/types/argument.py:5: in
from .structures import NonNull
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from .unmountedtype import UnmountedType
> from .utils import get_type
E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
graphene/types/structures.py:2: ImportError
The above exception was the direct cause of the following exception:
cls =
func = . at 0x7f97928d5120>
when = 'setup'
reraise = (, )
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
.venv/lib/python3.11/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/_pytest/runner.py:242: in
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:70: in unraisable_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/logging.py:840: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
.venv/lib/python3.11/site-packages/_pytest/logging.py:829: in _runtest_for
yield
.venv/lib/python3.11/site-packages/_pytest/capture.py:875: in pytest_runtest_setup
return (yield)
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/runner.py:160: in pytest_runtest_setup
item.session._setupstate.setup(item)
.venv/lib/python3.11/site-packages/_pytest/runner.py:507: in setup
raise exc[0].with_traceback(exc[1])
.venv/lib/python3.11/site-packages/_pytest/runner.py:514: in setup
col.setup()
.venv/lib/python3.11/site-packages/_pytest/python.py:663: in setup
init_mod = importtestmodule(self.path / "__init__.py", self.config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = PosixPath('/testbed/graphene/__init__.py')
config = <_pytest.config.Config object at 0x7f9793341190>
def importtestmodule(
path: Path,
config: Config,
):
# We assume we are only called once per module.
importmode = config.getoption("--import-mode")
try:
mod = import_path(
path,
mode=importmode,
root=config.rootpath,
consider_namespace_packages=config.getini("consider_namespace_packages"),
)
except SyntaxError as e:
raise nodes.Collector.CollectError(
ExceptionInfo.from_current().getrepr(style="short")
) from e
except ImportPathMismatchError as e:
raise nodes.Collector.CollectError(
"import file mismatch:\n"
"imported module {!r} has this __file__ attribute:\n"
" {}\n"
"which is not the same as the test file we want to collect:\n"
" {}\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules".format(*e.args)
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.get_verbosity() < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = str(exc_repr)
> raise nodes.Collector.CollectError(
f"ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
f"{formatted_tb}"
) from e
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/testbed/graphene/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E /root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126: in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E graphene/__init__.py:2: in
E from .relay import (
E graphene/relay/__init__.py:1: in
E from .node import Node, is_node, GlobalID
E graphene/relay/node.py:3: in
E from ..types import Field, Interface, ObjectType
E graphene/types/__init__.py:4: in
E from .argument import Argument
E graphene/types/argument.py:5: in
E from .structures import NonNull
E graphene/types/structures.py:2: in
E from .utils import get_type
E E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
.venv/lib/python3.11/site-packages/_pytest/python.py:523: CollectError
test_orderedtype.py::test_orderedtype_hash
test_orderedtype.py::test_orderedtype_hash
name = 'graphene', package = None
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
level = 0
if name.startswith('.'):
if not package:
msg = ("the 'package' argument is required to perform a relative "
"import for {!r}")
raise TypeError(msg.format(name))
for character in name:
if character != '.':
break
level += 1
> return _bootstrap._gcd_import(name[level:], package, level)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/__init__.py:2: in
from .relay import (
graphene/relay/__init__.py:1: in
from .node import Node, is_node, GlobalID
graphene/relay/node.py:3: in
from ..types import Field, Interface, ObjectType
graphene/types/__init__.py:4: in
from .argument import Argument
graphene/types/argument.py:5: in
from .structures import NonNull
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from .unmountedtype import UnmountedType
> from .utils import get_type
E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
graphene/types/structures.py:2: ImportError
The above exception was the direct cause of the following exception:
cls =
func = . at 0x7f9792ae05e0>
when = 'setup'
reraise = (, )
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
.venv/lib/python3.11/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/_pytest/runner.py:242: in
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:70: in unraisable_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/logging.py:840: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
.venv/lib/python3.11/site-packages/_pytest/logging.py:829: in _runtest_for
yield
.venv/lib/python3.11/site-packages/_pytest/capture.py:875: in pytest_runtest_setup
return (yield)
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/runner.py:160: in pytest_runtest_setup
item.session._setupstate.setup(item)
.venv/lib/python3.11/site-packages/_pytest/runner.py:507: in setup
raise exc[0].with_traceback(exc[1])
.venv/lib/python3.11/site-packages/_pytest/runner.py:514: in setup
col.setup()
.venv/lib/python3.11/site-packages/_pytest/python.py:663: in setup
init_mod = importtestmodule(self.path / "__init__.py", self.config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = PosixPath('/testbed/graphene/__init__.py')
config = <_pytest.config.Config object at 0x7f9793341190>
def importtestmodule(
path: Path,
config: Config,
):
# We assume we are only called once per module.
importmode = config.getoption("--import-mode")
try:
mod = import_path(
path,
mode=importmode,
root=config.rootpath,
consider_namespace_packages=config.getini("consider_namespace_packages"),
)
except SyntaxError as e:
raise nodes.Collector.CollectError(
ExceptionInfo.from_current().getrepr(style="short")
) from e
except ImportPathMismatchError as e:
raise nodes.Collector.CollectError(
"import file mismatch:\n"
"imported module {!r} has this __file__ attribute:\n"
" {}\n"
"which is not the same as the test file we want to collect:\n"
" {}\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules".format(*e.args)
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.get_verbosity() < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = str(exc_repr)
> raise nodes.Collector.CollectError(
f"ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
f"{formatted_tb}"
) from e
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/testbed/graphene/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E /root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126: in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E graphene/__init__.py:2: in
E from .relay import (
E graphene/relay/__init__.py:1: in
E from .node import Node, is_node, GlobalID
E graphene/relay/node.py:3: in
E from ..types import Field, Interface, ObjectType
E graphene/types/__init__.py:4: in
E from .argument import Argument
E graphene/types/argument.py:5: in
E from .structures import NonNull
E graphene/types/structures.py:2: in
E from .utils import get_type
E E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
.venv/lib/python3.11/site-packages/_pytest/python.py:523: CollectError
test_orderedtype.py::test_orderedtype_resetcounter
test_orderedtype.py::test_orderedtype_resetcounter
name = 'graphene', package = None
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
level = 0
if name.startswith('.'):
if not package:
msg = ("the 'package' argument is required to perform a relative "
"import for {!r}")
raise TypeError(msg.format(name))
for character in name:
if character != '.':
break
level += 1
> return _bootstrap._gcd_import(name[level:], package, level)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/__init__.py:2: in
from .relay import (
graphene/relay/__init__.py:1: in
from .node import Node, is_node, GlobalID
graphene/relay/node.py:3: in
from ..types import Field, Interface, ObjectType
graphene/types/__init__.py:4: in
from .argument import Argument
graphene/types/argument.py:5: in
from .structures import NonNull
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from .unmountedtype import UnmountedType
> from .utils import get_type
E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
graphene/types/structures.py:2: ImportError
The above exception was the direct cause of the following exception:
cls =
func = . at 0x7f97928f9c60>
when = 'setup'
reraise = (, )
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
.venv/lib/python3.11/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/_pytest/runner.py:242: in
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:70: in unraisable_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/logging.py:840: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
.venv/lib/python3.11/site-packages/_pytest/logging.py:829: in _runtest_for
yield
.venv/lib/python3.11/site-packages/_pytest/capture.py:875: in pytest_runtest_setup
return (yield)
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/runner.py:160: in pytest_runtest_setup
item.session._setupstate.setup(item)
.venv/lib/python3.11/site-packages/_pytest/runner.py:507: in setup
raise exc[0].with_traceback(exc[1])
.venv/lib/python3.11/site-packages/_pytest/runner.py:514: in setup
col.setup()
.venv/lib/python3.11/site-packages/_pytest/python.py:663: in setup
init_mod = importtestmodule(self.path / "__init__.py", self.config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = PosixPath('/testbed/graphene/__init__.py')
config = <_pytest.config.Config object at 0x7f9793341190>
def importtestmodule(
path: Path,
config: Config,
):
# We assume we are only called once per module.
importmode = config.getoption("--import-mode")
try:
mod = import_path(
path,
mode=importmode,
root=config.rootpath,
consider_namespace_packages=config.getini("consider_namespace_packages"),
)
except SyntaxError as e:
raise nodes.Collector.CollectError(
ExceptionInfo.from_current().getrepr(style="short")
) from e
except ImportPathMismatchError as e:
raise nodes.Collector.CollectError(
"import file mismatch:\n"
"imported module {!r} has this __file__ attribute:\n"
" {}\n"
"which is not the same as the test file we want to collect:\n"
" {}\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules".format(*e.args)
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.get_verbosity() < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = str(exc_repr)
> raise nodes.Collector.CollectError(
f"ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
f"{formatted_tb}"
) from e
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/testbed/graphene/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E /root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126: in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E graphene/__init__.py:2: in
E from .relay import (
E graphene/relay/__init__.py:1: in
E from .node import Node, is_node, GlobalID
E graphene/relay/node.py:3: in
E from ..types import Field, Interface, ObjectType
E graphene/types/__init__.py:4: in
E from .argument import Argument
E graphene/types/argument.py:5: in
E from .structures import NonNull
E graphene/types/structures.py:2: in
E from .utils import get_type
E E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
.venv/lib/python3.11/site-packages/_pytest/python.py:523: CollectError
test_orderedtype.py::test_orderedtype_non_orderabletypes
test_orderedtype.py::test_orderedtype_non_orderabletypes
name = 'graphene', package = None
def import_module(name, package=None):
"""Import a module.
The 'package' argument is required when performing a relative import. It
specifies the package to use as the anchor point from which to resolve the
relative import to an absolute import.
"""
level = 0
if name.startswith('.'):
if not package:
msg = ("the 'package' argument is required to perform a relative "
"import for {!r}")
raise TypeError(msg.format(name))
for character in name:
if character != '.':
break
level += 1
> return _bootstrap._gcd_import(name[level:], package, level)
/root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
graphene/__init__.py:2: in
from .relay import (
graphene/relay/__init__.py:1: in
from .node import Node, is_node, GlobalID
graphene/relay/node.py:3: in
from ..types import Field, Interface, ObjectType
graphene/types/__init__.py:4: in
from .argument import Argument
graphene/types/argument.py:5: in
from .structures import NonNull
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
from .unmountedtype import UnmountedType
> from .utils import get_type
E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
graphene/types/structures.py:2: ImportError
The above exception was the direct cause of the following exception:
cls =
func = . at 0x7f9792ae05e0>
when = 'setup'
reraise = (, )
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
) -> CallInfo[TResult]:
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
:type func: Callable[[], _pytest.runner.TResult]
:param when:
The phase in which the function is called.
:param reraise:
Exception or exceptions that shall propagate if raised by the
function, instead of being wrapped in the CallInfo.
"""
excinfo = None
start = timing.time()
precise_start = timing.perf_counter()
try:
> result: TResult | None = func()
.venv/lib/python3.11/site-packages/_pytest/runner.py:341:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.venv/lib/python3.11/site-packages/_pytest/runner.py:242: in
lambda: runtest_hook(item=item, **kwds), when=when, reraise=reraise
.venv/lib/python3.11/site-packages/pluggy/_hooks.py:513: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
.venv/lib/python3.11/site-packages/pluggy/_manager.py:120: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:90: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/unraisableexception.py:70: in unraisable_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/logging.py:840: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
.venv/lib/python3.11/site-packages/_pytest/logging.py:829: in _runtest_for
yield
.venv/lib/python3.11/site-packages/_pytest/capture.py:875: in pytest_runtest_setup
return (yield)
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:87: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
.venv/lib/python3.11/site-packages/_pytest/threadexception.py:68: in thread_exception_runtest_hook
yield
.venv/lib/python3.11/site-packages/_pytest/runner.py:160: in pytest_runtest_setup
item.session._setupstate.setup(item)
.venv/lib/python3.11/site-packages/_pytest/runner.py:507: in setup
raise exc[0].with_traceback(exc[1])
.venv/lib/python3.11/site-packages/_pytest/runner.py:514: in setup
col.setup()
.venv/lib/python3.11/site-packages/_pytest/python.py:663: in setup
init_mod = importtestmodule(self.path / "__init__.py", self.config)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
path = PosixPath('/testbed/graphene/__init__.py')
config = <_pytest.config.Config object at 0x7f9793341190>
def importtestmodule(
path: Path,
config: Config,
):
# We assume we are only called once per module.
importmode = config.getoption("--import-mode")
try:
mod = import_path(
path,
mode=importmode,
root=config.rootpath,
consider_namespace_packages=config.getini("consider_namespace_packages"),
)
except SyntaxError as e:
raise nodes.Collector.CollectError(
ExceptionInfo.from_current().getrepr(style="short")
) from e
except ImportPathMismatchError as e:
raise nodes.Collector.CollectError(
"import file mismatch:\n"
"imported module {!r} has this __file__ attribute:\n"
" {}\n"
"which is not the same as the test file we want to collect:\n"
" {}\n"
"HINT: remove __pycache__ / .pyc files and/or use a "
"unique basename for your test file modules".format(*e.args)
) from e
except ImportError as e:
exc_info = ExceptionInfo.from_current()
if config.get_verbosity() < 2:
exc_info.traceback = exc_info.traceback.filter(filter_traceback)
exc_repr = (
exc_info.getrepr(style="short")
if exc_info.traceback
else exc_info.exconly()
)
formatted_tb = str(exc_repr)
> raise nodes.Collector.CollectError(
f"ImportError while importing test module '{path}'.\n"
"Hint: make sure your test modules/packages have valid Python names.\n"
"Traceback:\n"
f"{formatted_tb}"
) from e
E _pytest.nodes.Collector.CollectError: ImportError while importing test module '/testbed/graphene/__init__.py'.
E Hint: make sure your test modules/packages have valid Python names.
E Traceback:
E /root/.local/share/uv/python/cpython-3.11.10-linux-x86_64-gnu/lib/python3.11/importlib/__init__.py:126: in import_module
E return _bootstrap._gcd_import(name[level:], package, level)
E graphene/__init__.py:2: in
E from .relay import (
E graphene/relay/__init__.py:1: in
E from .node import Node, is_node, GlobalID
E graphene/relay/node.py:3: in
E from ..types import Field, Interface, ObjectType
E graphene/types/__init__.py:4: in
E from .argument import Argument
E graphene/types/argument.py:5: in
E from .structures import NonNull
E graphene/types/structures.py:2: in
E from .utils import get_type
E E ImportError: cannot import name 'get_type' from 'graphene.types.utils' (/testbed/graphene/types/utils.py)
.venv/lib/python3.11/site-packages/_pytest/python.py:523: CollectError
Patch diff
diff --git a/graphene/types/scalars.py b/graphene/types/scalars.py
index d42a1ab..9daa3b3 100644
--- a/graphene/types/scalars.py
+++ b/graphene/types/scalars.py
@@ -30,7 +30,14 @@ class Scalar(UnmountedType, BaseType):
This function is called when the unmounted type (Scalar instance)
is mounted (as a Field, InputField or Argument)
"""
- pass
+ from graphql import GraphQLScalarType
+ return GraphQLScalarType(
+ name=cls.__name__,
+ description=cls.__doc__,
+ serialize=cls.serialize,
+ parse_value=cls.parse_value,
+ parse_literal=cls.parse_literal
+ )
MAX_INT = 2147483647
MIN_INT = -2147483648
@@ -44,6 +51,13 @@ class Int(Scalar):
serialize = coerce_int
parse_value = coerce_int
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, IntValueNode):
+ value = int(ast.value)
+ if MIN_INT <= value <= MAX_INT:
+ return value
+ return Undefined
class BigInt(Scalar):
"""
The `BigInt` scalar type represents non-fractional whole numeric values.
@@ -53,6 +67,13 @@ class BigInt(Scalar):
serialize = coerce_int
parse_value = coerce_int
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, IntValueNode):
+ return int(ast.value)
+ return Undefined
+
+
class Float(Scalar):
"""
The `Float` scalar type represents signed double-precision fractional
@@ -62,6 +83,13 @@ class Float(Scalar):
serialize = coerce_float
parse_value = coerce_float
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, (FloatValueNode, IntValueNode)):
+ return float(ast.value)
+ return Undefined
+
+
class String(Scalar):
"""
The `String` scalar type represents textual data, represented as UTF-8
@@ -71,6 +99,13 @@ class String(Scalar):
serialize = coerce_string
parse_value = coerce_string
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, StringValueNode):
+ return ast.value
+ return Undefined
+
+
class Boolean(Scalar):
"""
The `Boolean` scalar type represents `true` or `false`.
@@ -78,6 +113,13 @@ class Boolean(Scalar):
serialize = bool
parse_value = bool
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, BooleanValueNode):
+ return ast.value
+ return Undefined
+
+
class ID(Scalar):
"""
The `ID` scalar type represents a unique identifier, often used to
@@ -87,4 +129,10 @@ class ID(Scalar):
(such as `4`) input value will be accepted as an ID.
"""
serialize = str
- parse_value = str
\ No newline at end of file
+ parse_value = str
+
+ @staticmethod
+ def parse_literal(ast):
+ if isinstance(ast, (StringValueNode, IntValueNode)):
+ return str(ast.value)
+ return Undefined