Skip to content

Wrong minimum version of pytest #262

Closed
@cnaaq

Description

@cnaaq

I am using pytest v5.4.3 and I receive the following error when executing test cases:

File "D:\.venv\lib\site-packages\_pytest\config\argparsing.py", line 177, in addini
    assert type in (None, "pathlist", "args", "linelist", "bool")
AssertionError: type: string

In pytest v5.4.3 the string type is not yet added to the assertion, thus the error.

A bit more detail:

The pytest-asyncio plugin calls the addini method like this:

parser.addini(
    "asyncio_mode",
    help="default value for --asyncio-mode",
    type="string",  # <----- Problem
    default="legacy",
)

whereas the addini method (in _pytest/config/argparsing.py) looks like this (in v5.4.3):

    def addini(
        self,
        name: str,
        help: str,
        type: Optional["Literal['pathlist', 'args', 'linelist', 'bool']"] = None,
        default=None,
    ) -> None:
        
        assert type in (None, "pathlist", "args", "linelist", "bool")
        ...

So, I think the minimum version of pytest should be adjusted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions