Skip to content

Error 'bool' object has no attribute 'origin' Config._getini #13946

@pvleuven

Description

@pvleuven

Hi,

The following bool setting causes an exception in pytest 9.0.0. Evidentially a bool has no attribute origin.

def pytest_configure(config):
    config.inicfg["xfail_strict"] = True

Exception thrown:

<somewhere>\_pytest\config\__init__.py:1666: in _getini
    selected = max(candidates, key=lambda x: (x[0].origin == "override", x[1]))[0]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

x = (True, True)

>   selected = max(candidates, key=lambda x: (x[0].origin == "override", x[1]))[0]
                                              ^^^^^^^^^^^
E   AttributeError: 'bool' object has no attribute 'origin'

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: configrelated to config handling, argument parsing and config filetype: deprecationfeature that will be removed in the future

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions