Tests in `graphene/relay/tests/test_custom_global_id.py` fail due incompatibility with pytest 8.x
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Aptitud para principiantes
- 55/100
Línea de trabajo
Comienza con graphene/relay/tests/test_custom_global_id.py e inspecciona las cuatro clases de prueba que usan setup(self). Ejecuta pytest sobre este archivo para reproducir la advertencia y el fallo de pytest 8.x. La tarea está terminada cuando los métodos de configuración de las pruebas usan una nomenclatura compatible con pytest y el archivo pasa bajo pytest 8.x.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
- What is the current behavior?
Running the test suite, in particular the tests in graphene/relay/tests/test_custom_global_id.py fail if pytest 8.x is used.
__________ ERROR at setup of TestUUIDGlobalID.test_str_schema_correct __________
cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x7fdc59d0b920>
when = 'setup'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)
@classmethod
def from_call(
cls,
func: Callable[[], TResult],
when: Literal["collect", "setup", "call", "teardown"],
reraise: Optional[
Union[Type[BaseException], Tuple[Type[BaseException], ...]]
] = None,
) -> "CallInfo[TResult]":
"""Call func, wrapping the result in a CallInfo.
:param func:
The function to call. Called without arguments.
: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: Optional[TResult] = func()
/usr/lib/python3/dist-packages/_pytest/runner.py:342:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3/dist-packages/_pytest/runner.py:263: in <lambda>
lambda: ihook(item=item, **kwds), when=when, reraise=reraise
/usr/lib/python3/dist-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3/dist-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3/dist-packages/_pytest/unraisableexception.py:85: in pytest_runtest_setup
yield from unraisable_exception_runtest_hook()
/usr/lib/python3/dist-packages/_pytest/unraisableexception.py:65: in unraisable_exception_runtest_hook
yield
/usr/lib/python3/dist-packages/_pytest/logging.py:833: in pytest_runtest_setup
yield from self._runtest_for(item, "setup")
/usr/lib/python3/dist-packages/_pytest/logging.py:822: in _runtest_for
yield
/usr/lib/python3/dist-packages/_pytest/capture.py:877: in pytest_runtest_setup
return (yield)
/usr/lib/python3/dist-packages/_pytest/threadexception.py:82: in pytest_runtest_setup
yield from thread_exception_runtest_hook()
/usr/lib/python3/dist-packages/_pytest/threadexception.py:63: in thread_exception_runtest_hook
yield
/usr/lib/python3/dist-packages/_pytest/runner.py:158: in pytest_runtest_setup
item.session._setupstate.setup(item)
/usr/lib/python3/dist-packages/_pytest/runner.py:514: in setup
raise exc
/usr/lib/python3/dist-packages/_pytest/runner.py:511: in setup
col.setup()
/usr/lib/python3/dist-packages/_pytest/python.py:1834: in setup
self._request._fillfixtures()
/usr/lib/python3/dist-packages/_pytest/fixtures.py:689: in _fillfixtures
item.funcargs[argname] = self.getfixturevalue(argname)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:547: in getfixturevalue
fixturedef = self._get_active_fixturedef(argname)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:566: in _get_active_fixturedef
self._compute_fixture_value(fixturedef)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:648: in _compute_fixture_value
fixturedef.execute(request=subrequest)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:1087: in execute
result = ihook.pytest_fixture_setup(fixturedef=self, request=request)
/usr/lib/python3/dist-packages/pluggy/_hooks.py:501: in __call__
return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/usr/lib/python3/dist-packages/pluggy/_manager.py:119: in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/usr/lib/python3/dist-packages/_pytest/setuponly.py:36: in pytest_fixture_setup
return (yield)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:1140: in pytest_fixture_setup
result = call_fixture_func(fixturefunc, request, kwargs)
/usr/lib/python3/dist-packages/_pytest/fixtures.py:910: in call_fixture_func
fixture_result = next(generator)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <graphene.relay.tests.test_custom_global_id.TestUUIDGlobalID object at 0x7fdc5984f490>
request = <SubRequest '_xunit_setup_method_fixture_TestUUIDGlobalID' for <Function test_str_schema_correct>>
@fixtures.fixture(
autouse=True,
scope="function",
# Use a unique name to speed up lookup.
name=f"_xunit_setup_method_fixture_{self.obj.__qualname__}",
)
def xunit_setup_method_fixture(self, request) -> Generator[None, None, None]:
method = request.function
if setup_method is not None:
func = getattr(self, setup_name)
_call_with_optional_argument(func, method)
if emit_nose_setup_warning:
> warnings.warn(
NOSE_SUPPORT_METHOD.format(
nodeid=request.node.nodeid, method="setup"
),
stacklevel=2,
)
E pytest.PytestRemovedIn8Warning: Support for nose tests is deprecated and will be removed in a future release.
E graphene/relay/tests/test_custom_global_id.py::TestUUIDGlobalID::test_str_schema_correct is using nose-specific method: `setup(self)`
E To remove this warning, rename it to `setup_method(self)`
E See docs: https://docs.pytest.org/en/stable/deprecations.html#support-for-tests-written-for-nose
...
The root for this behavior is the usage of setup(self) within the class definitions in that file which is nose specific syntax. The solution is rather simple and already written within the error message as the solution for the failing tests.
diff --git a/graphene/relay/tests/test_custom_global_id.py b/graphene/relay/tests/test_custom_global_id.py
index c1bf0fb..8f79914 100644
--- a/graphene/relay/tests/test_custom_global_id.py
+++ b/graphene/relay/tests/test_custom_global_id.py
@@ -9,7 +9,7 @@ from ...types import Int, ObjectType, Schema, String
class TestUUIDGlobalID:
- def setup(self):
+ def setup_method(self):
self.user_list = [
{"id": uuid4(), "name": "First"},
{"id": uuid4(), "name": "Second"},
@@ -77,7 +77,7 @@ class TestUUIDGlobalID:
class TestSimpleGlobalID:
- def setup(self):
+ def setup_method(self):
self.user_list = [
{"id": "my global primary key in clear 1", "name": "First"},
{"id": "my global primary key in clear 2", "name": "Second"},
@@ -140,7 +140,7 @@ class TestSimpleGlobalID:
class TestCustomGlobalID:
- def setup(self):
+ def setup_method(self):
self.user_list = [
{"id": 1, "name": "First"},
{"id": 2, "name": "Second"},
@@ -219,7 +219,7 @@ class TestCustomGlobalID:
class TestIncompleteCustomGlobalID:
- def setup(self):
+ def setup_method(self):
self.user_list = [
{"id": 1, "name": "First"},
{"id": 2, "name": "Second"},
-
Please tell us about your environment:
- Version: 3.3.0
- Platform: Debian unstable
- Lenguaje dominante
- Python
- Estrellas
- 8.2k
- Forks
- 822
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de graphql-python/graphene
-
Tutorial mistakesAbierto🐛 bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
graphql-python/graphene#1389 · 5 comentarios · 2 reacciones ·
-
Support OneOf input object typesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
graphql-python/graphene#1606 ·
-
Python 3.14 supportAbierto✨ enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
graphql-python/graphene#1601 · 2 comentarios ·
-
✨ enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
graphql-python/graphene#1600 ·
-
Inaccurate Float-to-Decimal Conversion in `parse_value` of `Decimal` `Scalar`Posiblemente ocupada @mak626 la tomó hace 608 días. Abierto🐛 bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
graphql-python/graphene#1593 ·
Todos los issues de graphql-python/graphene
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
esphome/esphome.io#7657 ·
Los mantenedores suelen responder en 1 día
-
comp/gateway comp/plugins duplicate P3 type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NousResearch/hermes-agent#137019 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Kumo-Tabular weights unreachable behind restrictive egress proxies (Xet + plain HTTP both fail)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
NVIDIA/structured-data-models#1091 ·
Los mantenedores suelen responder en 1 día
-
[work-item] adam-adae-worsening-emergence: conform spec.yaml to the specification style contract (REQ-1280)Posiblemente ocupada @muse-yamaa-bot la tomó hoy. Abiertowork-item
Dificultad 1/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día