Bug 2275120 - python-pytest-cases fails to build with pytest 8: AttributeError: 'str' object has no attribute 'iter_parents'
Summary: python-pytest-cases fails to build with pytest 8: AttributeError: 'str' objec...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-pytest-cases
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Zbigniew Jędrzejewski-Szmek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 2256331
TreeView+ depends on / blocked
 
Reported: 2024-04-15 13:43 UTC by Tomáš Hrnčiar
Modified: 2024-06-16 10:04 UTC (History)
4 users (show)

Fixed In Version: python-pytest-cases-3.8.5-1.fc41
Clone Of:
Environment:
Last Closed: 2024-06-16 10:04:31 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2024-04-15 13:43:13 UTC
python-pytest-cases fails to build with pytest 8.

==================================== ERRORS ====================================
_______________________ ERROR at setup of test_synthesis _______________________

request = <SubRequest 'module_results_dct' for <Function test_synthesis>>
fixture_store = OrderedDict()

    @pytest.fixture(scope='function')
    def module_results_dct(request, fixture_store):
        # type: (...) -> Mapping[str, Mapping[str, Any]]
        """
        This fixture returns a synthesis dictionary for all tests completed "so far" in the module of the caller,
        with 'function' id format. It includes contents from the default `fixture_store`, including `results_bag`.
    
        Behind the scenes it relies on `get_session_synthesis_dct`.
    
        This fixture has a function scope because we want its contents to be refreshed every time it is needed.
        """
>       return get_module_results_dct(request, module_name=request.module.__name__, fixture_store=fixture_store)

/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:188: in get_module_results_dct
    results_dct = get_session_synthesis_dct(session_or_request, durations_in_ms=True,
/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:213: in get_session_synthesis_dct
    param_dct = get_pytest_params(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_caching[dummy-a=0-d=0]>

    def get_pytest_params(item):
        """ Returns a dictionary containing a pytest session item's parameters """
    
        if isinstance(item, _MinimalItem):
            # Our special _MinimalItem object - when xdist is used and worker states have been saved + restored
            return item.get_pytest_params()
        elif isinstance(item, DoctestItem):
            # No fixtures or parameters
            return OrderedDict()
        else:
            param_dct = OrderedDict()
            for param_name in item.fixturenames:  # note: item.funcargnames gives the exact same list
                if hasattr(item, 'callspec'):
                    if param_name in item.callspec.params:
                        param_value = item.callspec.params[param_name]
                        if is_lazy_value_or_tupleitem_with_int_base(param_value):
                            # remove the int base so that pandas does not interprete it as an int.
                            param_value = param_value.clone(remove_int_base=True)
>                       if item.session._fixturemanager.getfixturedefs(param_name, item.nodeid) is not None:
E                       AttributeError: 'str' object has no attribute 'iter_parents'

/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:507: AttributeError
_______________________ ERROR at setup of test_synthesis _______________________

request = <SubRequest 'module_results_dct' for <Function test_synthesis>>
fixture_store = OrderedDict()

    @pytest.fixture(scope='function')
    def module_results_dct(request, fixture_store):
        # type: (...) -> Mapping[str, Mapping[str, Any]]
        """
        This fixture returns a synthesis dictionary for all tests completed "so far" in the module of the caller,
        with 'function' id format. It includes contents from the default `fixture_store`, including `results_bag`.
    
        Behind the scenes it relies on `get_session_synthesis_dct`.
    
        This fixture has a function scope because we want its contents to be refreshed every time it is needed.
        """
>       return get_module_results_dct(request, module_name=request.module.__name__, fixture_store=fixture_store)

/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:188: in get_module_results_dct
    results_dct = get_session_synthesis_dct(session_or_request, durations_in_ms=True,
/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:213: in get_session_synthesis_dct
    param_dct = get_pytest_params(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_default_idstyle[hello]>

    def get_pytest_params(item):
        """ Returns a dictionary containing a pytest session item's parameters """
    
        if isinstance(item, _MinimalItem):
            # Our special _MinimalItem object - when xdist is used and worker states have been saved + restored
            return item.get_pytest_params()
        elif isinstance(item, DoctestItem):
            # No fixtures or parameters
            return OrderedDict()
        else:
            param_dct = OrderedDict()
            for param_name in item.fixturenames:  # note: item.funcargnames gives the exact same list
                if hasattr(item, 'callspec'):
                    if param_name in item.callspec.params:
                        param_value = item.callspec.params[param_name]
                        if is_lazy_value_or_tupleitem_with_int_base(param_value):
                            # remove the int base so that pandas does not interprete it as an int.
                            param_value = param_value.clone(remove_int_base=True)
>                       if item.session._fixturemanager.getfixturedefs(param_name, item.nodeid) is not None:
E                       AttributeError: 'str' object has no attribute 'iter_parents'

/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:507: AttributeError
__________________ ERROR at setup of test_with_data_synthesis __________________

request = <SubRequest 'module_results_dct' for <Function test_with_data_synthesis>>
fixture_store = OrderedDict()

    @pytest.fixture(scope='function')
    def module_results_dct(request, fixture_store):
        # type: (...) -> Mapping[str, Mapping[str, Any]]
        """
        This fixture returns a synthesis dictionary for all tests completed "so far" in the module of the caller,
        with 'function' id format. It includes contents from the default `fixture_store`, including `results_bag`.
    
        Behind the scenes it relies on `get_session_synthesis_dct`.
    
        This fixture has a function scope because we want its contents to be refreshed every time it is needed.
        """
>       return get_module_results_dct(request, module_name=request.module.__name__, fixture_store=fixture_store)

/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:219: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.12/site-packages/pytest_harvest/plugin.py:188: in get_module_results_dct
    results_dct = get_session_synthesis_dct(session_or_request, durations_in_ms=True,
/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:213: in get_session_synthesis_dct
    param_dct = get_pytest_params(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

item = <Function test_default_pytest_order[bob-a]>

    def get_pytest_params(item):
        """ Returns a dictionary containing a pytest session item's parameters """
    
        if isinstance(item, _MinimalItem):
            # Our special _MinimalItem object - when xdist is used and worker states have been saved + restored
            return item.get_pytest_params()
        elif isinstance(item, DoctestItem):
            # No fixtures or parameters
            return OrderedDict()
        else:
            param_dct = OrderedDict()
            for param_name in item.fixturenames:  # note: item.funcargnames gives the exact same list
                if hasattr(item, 'callspec'):
                    if param_name in item.callspec.params:
                        param_value = item.callspec.params[param_name]
                        if is_lazy_value_or_tupleitem_with_int_base(param_value):
                            # remove the int base so that pandas does not interprete it as an int.
                            param_value = param_value.clone(remove_int_base=True)
>                       if item.session._fixturemanager.getfixturedefs(param_name, item.nodeid) is not None:
E                       AttributeError: 'str' object has no attribute 'iter_parents'

/usr/lib/python3.12/site-packages/pytest_harvest/results_session.py:507: AttributeError

=========================== short test summary info ============================
FAILED tests/cases/doc/test_doc.py::test_foo1_synthesis - AttributeError: 'st...
FAILED tests/cases/doc/test_doc.py::test_foo_default_cases_file_synthesis - A...
FAILED tests/cases/doc/test_doc.py::test_foo_fun_synthesis - AttributeError: ...
FAILED tests/cases/doc/test_doc.py::test_foo_fun_list_synthesis - AttributeEr...
FAILED tests/cases/doc/test_doc.py::test_foo_cls_synthesis - AttributeError: ...
FAILED tests/cases/doc/test_doc.py::test_foo_cls_list_synthesis - AttributeEr...
FAILED tests/cases/doc/test_doc.py::test_foo_parametrize_fixture_synthesis - ...
FAILED tests/cases/doc/test_doc_alternate.py::test_foo_alternate_cases_file_and_two_marked_skip_synthesis
FAILED tests/cases/doc/test_doc_filters_n_tags.py::test_foo_fixtures_synthesis
FAILED tests/cases/doc/test_fixtures.py::test_users_synthesis - AttributeErro...
FAILED tests/cases/doc/test_generators.py::test_foo_synthesis - AttributeErro...
FAILED tests/cases/doc/test_generators.py::test_foo_multi_synthesis - Attribu...
FAILED tests/pytest_extension/meta/test_all.py::test_run_all_tests[session_optim]
FAILED tests/pytest_extension/parametrize_plus/test_basics_misc.py::test_idgen1_synthesis
FAILED tests/pytest_extension/parametrize_plus/test_basics_misc.py::test_alt_usage1_synthesis
FAILED tests/pytest_extension/parametrize_plus/test_basics_misc.py::test_alt_usage2_synthesis
FAILED tests/pytest_extension/parametrize_plus/test_fixture_ref_custom1.py::test_synthesis1
FAILED tests/pytest_extension/parametrize_plus/test_fixture_ref_custom1.py::test_synthesis2
ERROR tests/cases/doc/test_doc_cache.py::test_synthesis - AttributeError: 'st...
ERROR tests/cases/doc/test_doc_debug.py::test_synthesis - AttributeError: 'st...
ERROR tests/cases/doc/test_doc_filters_n_tags.py::test_with_data_synthesis - ...
ERROR tests/cases/doc/test_doc_filters_n_tags2.py::test_synthesis - Attribute...
ERROR tests/cases/doc/test_doc_filters_n_tags2.py::test_synthesis2 - Attribut...
ERROR tests/cases/doc/test_doc_ids.py::test_synthesis - AttributeError: 'str'...
ERROR tests/cases/doc/test_indirect.py::test_synthesis - AttributeError: 'str...
ERROR tests/cases/issues/test_issue_126.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_126_2.py::test_synthesis - AttributeError...
ERROR tests/cases/issues/test_issue_142.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_142_2.py::test_synthesis - AttributeError...
ERROR tests/cases/issues/test_issue_151.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_154.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_158_2.py::test_synthesis - AttributeError...
ERROR tests/cases/issues/test_issue_159.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_168.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_171.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_179.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_211.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_242.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_issue_274.py::test_synthesis - AttributeError: ...
ERROR tests/cases/issues/test_py35_issue_176.py::test_synthesis - AttributeEr...
ERROR tests/pytest_extension/doc/test_doc_fixture_graph_union_normal.py::test_synthesis_1[-1]
ERROR tests/pytest_extension/doc/test_doc_fixture_graph_union_union.py::test_synthesis_1[-1]
ERROR tests/pytest_extension/doc/test_doc_parametrize.py::test_synthesis - At...
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixture_unpacking.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixture_unpacking2.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixtures_parametrize.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixtures_parametrize.py::test_synthesis2
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixtures_paramfixtures.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_fixtures_paramfixtures_marks.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_plus_and_others/test_skip_on_paramz_fixture.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixture_union_custom_mark.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixture_union_ids.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixture_union_setup_teardown2.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixtures_union_0simplest.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixtures_union_1simple.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_fixtures_union_2hard.py::test_synthesis
ERROR tests/pytest_extension/fixtures/fixture_unions/test_so.py::test_synthesis
ERROR tests/pytest_extension/fixtures/test_hook.py::test_synthesis - Attribut...
ERROR tests/pytest_extension/issues/test_issue_124.py::test_synthesis - Attri...
ERROR tests/pytest_extension/issues/test_issue_148.py::test_synthesis - Attri...
ERROR tests/pytest_extension/issues/test_issue_177.py::test_synthesis - Attri...
ERROR tests/pytest_extension/issues/test_issue_fixture_union1.py::test_synthesis
ERROR tests/pytest_extension/issues/test_issue_fixture_union2.py::test_synthesis
ERROR tests/pytest_extension/issues/test_issue_pytest_70.py::test_synthesis
ERROR tests/pytest_extension/issues/test_issue_so_76.py::test_synthesis - Att...
ERROR tests/pytest_extension/issues/test_parametrize_with_lists.py::test_synthesis
ERROR tests/pytest_extension/order/session_optim/test_reorder_default_normal.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_basic1.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_basic2.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_basic3_tuples.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_basic4_ids.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_custom2.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_custom3.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_fixture_ref_custom4_tuples.py::test_synthesis
ERROR tests/pytest_extension/parametrize_plus/test_lazy_value.py::test_synthesis2
ERROR tests/pytest_extension/parametrize_plus/test_lazy_value__custom_ids.py::test_synthesis2
ERROR tests/pytest_extension/parametrize_plus/test_lazy_value_and_fixture_ref.py::test_synthesis2
ERROR tests/pytest_extension/parametrize_plus/test_lazy_value_and_fixture_ref2.py::test_synthesis2
ERROR tests/pytest_extension/parametrize_plus/test_lazy_value_and_fixture_ref3.py::test_synthesis2
ERROR tests/pytest_extension/parametrize_plus/test_parametrizing_a_class.py::test_synthesis
==== 18 failed, 1286 passed, 116 skipped, 128 warnings, 62 errors in 5.87s =====

https://docs.pytest.org/en/stable/changelog.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/thrnciar/pytest/fedora-rawhide-x86_64/07248682-python-pytest-cases/

For all our attempts to build python-pytest-cases with pytest 8, see:
https://copr.fedorainfracloud.org/coprs/thrnciar/pytest/package/python-pytest-cases/

Let us know here if you have any questions.

Pytest 8 is planned to be included in Fedora 41. And this bugzilla is a
heads up before we merge new pytest into rawhide. For more info see a Fedora Change
proposal https://fedoraproject.org/wiki/Changes/Pytest_8

We'd appreciate help from the people who know this package best,
but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Zbigniew Jędrzejewski-Szmek 2024-06-10 18:16:22 UTC
This should fixed now. I didn't build with pytest-8, but upstream comments indicate that this is the case.
I'm pushed to dist-git but didn't build because of the python3.13 rebuild.


Note You need to log in before you can comment on or make changes to this bug.