str0zzapreti / pytest-retry

A simple plugin for retrying flaky tests in CI environments
MIT License
27 stars 6 forks source link

pytest 8.x appears to break this plugin #32

Closed tswast closed 5 months ago

tswast commented 5 months ago

Hello!

I'm seeing some failures when testing with the latest version of pytest 8.0.0 released this past weekend.

======================= the following tests were retried =======================
        test_create_text_generator_32k_model_default_session teardown failed on attempt 1! Exiting immediately!
        Traceback (most recent call last):
          File "/tmpfs/src/github/python-bigquery-dataframes/.nox/system-3-11/lib/python3.11/site-packages/_pytest/nodes.py", line 152, in _create
            return super().__call__(*k, **kw)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^
        TypeError: Can't instantiate abstract class Item with abstract method runtest

        During handling of the above exception, another exception occurred:

        Traceback (most recent call last):
          File "/tmpfs/src/github/python-bigquery-dataframes/.nox/system-3-11/lib/python3.11/site-packages/_pytest/runner.py", line 345, in from_call
            result: Optional[TResult] = func()
                                        ^^^^^^
          File "/tmpfs/src/github/python-bigquery-dataframes/.nox/system-3-11/lib/python3.11/site-packages/pytest_retry/retry_plugin.py", line 212, in <lambda>
            nextitem=pytest.Item.from_parent(item.session, name="fakeboi"),
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmpfs/src/github/python-bigquery-dataframes/.nox/system-3-11/lib/python3.11/site-packages/_pytest/nodes.py", line 275, in from_parent
            return cls._create(parent=parent, **kw)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/tmpfs/src/github/python-bigquery-dataframes/.nox/system-3-11/lib/python3.11/site-packages/_pytest/nodes.py", line 167, in _create
            return super().__call__(*k, **known_kw)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        TypeError: Can't instantiate abstract class Item with abstract method runtest

=========================== end of test retry report ===========================
str0zzapreti commented 5 months ago

Ah, I was afraid of that! I'll release a new version for Pytest 8 compatibility ASAP.

str0zzapreti commented 5 months ago

Fixed in https://github.com/str0zzapreti/pytest-retry/pull/35. I'd welcome a review from either of you if you have the time, otherwise I'll merge it in a little while and upload a new release so you'll have it by Monday

str0zzapreti commented 5 months ago

@tswast Thanks for calling this out. Fixed in https://github.com/str0zzapreti/pytest-retry/releases/tag/1.6.2