Tests fail with pytest 9

Aperta Adatta ai principianti
#87 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
testing

Direzione di ricerca

Inizia da tests/test_update_examples_dir.py e example/test_example.py, dove la raccolta non riesce perché la parametrizzazione riceve generatori. Leggi la configurazione della parametrizzazione in entrambi i test e consulta le indicazioni sulla deprecazione di pytest 9 incluse nel rapporto. Il lavoro è concluso quando entrambi i test vengono raccolti e la suite viene eseguita senza la PytestRemovedIn10Warning segnalata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

The following came up when building version 0.0.18 in Arch Linux, with pytest 9.1.1:

============================= test session starts ==============================
platform linux -- Python 3.14.8, pytest-9.1.1, pluggy-1.7.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /build/python-pytest-examples/src/pytest-examples-0.0.18
configfile: pyproject.toml
testpaths: tests, example
plugins: examples-0.0.18, platformdirs-4.13.0
collecting ... collected 66 items / 2 errors

==================================== ERRORS ====================================
______________ ERROR collecting tests/test_update_examples_dir.py ______________
/usr/lib/python3.14/site-packages/pluggy/_caller.py:197: in __call__
    return self._hookexec(
/usr/lib/python3.14/site-packages/pluggy/_manager.py:183: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:250: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:476: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
/usr/lib/python3.14/site-packages/pluggy/_caller.py:262: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pluggy/_manager.py:183: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:124: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
/usr/lib/python3.14/site-packages/_pytest/python.py:1316: in parametrize
    argnames, parametersets = ParameterSet._for_parametrize(
/usr/lib/python3.14/site-packages/_pytest/mark/structures.py:202: in _for_parametrize
    warnings.warn(
E   pytest.PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.
E   Test: tests/test_update_examples_dir.py::test_cases_update, argvalues type: generator
E   Please convert to a list or tuple.
E   See https://docs.pytest.org/en/stable/deprecations.html#parametrize-iterators
___________________ ERROR collecting example/test_example.py ___________________
/usr/lib/python3.14/site-packages/pluggy/_caller.py:197: in __call__
    return self._hookexec(
/usr/lib/python3.14/site-packages/pluggy/_manager.py:183: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:250: in pytest_pycollect_makeitem
    return list(collector._genfunctions(name, obj))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:476: in _genfunctions
    self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))
/usr/lib/python3.14/site-packages/pluggy/_caller.py:262: in call_extra
    return self._hookexec(self.name, hookimpls, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/pluggy/_manager.py:183: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/usr/lib/python3.14/site-packages/_pytest/python.py:124: in pytest_generate_tests
    metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
/usr/lib/python3.14/site-packages/_pytest/python.py:1316: in parametrize
    argnames, parametersets = ParameterSet._for_parametrize(
/usr/lib/python3.14/site-packages/_pytest/mark/structures.py:202: in _for_parametrize
    warnings.warn(
E   pytest.PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.
E   Test: example/test_example.py::test_will_error, argvalues type: generator
E   Please convert to a list or tuple.
E   See https://docs.pytest.org/en/stable/deprecations.html#parametrize-iterators
=========================== short test summary info ============================
ERROR tests/test_update_examples_dir.py - pytest.PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.
Test: tests/test_update_examples_dir.py::test_cases_update, argvalues type: generator
Please convert to a list or tuple.
See https://docs.pytest.org/en/stable/deprecations.html#parametrize-iterators
ERROR example/test_example.py - pytest.PytestRemovedIn10Warning: Passing a non-Collection iterable to parametrize is deprecated.
Test: example/test_example.py::test_will_error, argvalues type: generator
Please convert to a list or tuple.
See https://docs.pytest.org/en/stable/deprecations.html#parametrize-iterators
!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 2 errors in 0.44s ===============================
Lingua principale
Python
Stelle
181
Fork
29
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pydantic/pytest-examples

Tutte le issue di pydantic/pytest-examples

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.