Skip to content

6.0.0rc1 pytest.skip mypy error: Attribute function "__call__" ... does not accept self argument #7495

Closed
@simonjayhawkins

Description

@simonjayhawkins
  • a detailed description of the bug or suggestion
  • output of pip list from the virtual environment you are using
  • pytest and operating system versions
  • minimal example if possible
import pytest


def valid_config():
    return False


def test_function():
    if not valid_config():
        pytest.skip("unsupported configuration")
$ pytest ~/pytest-mypy.py 
=========================================================================== test session starts ============================================================================
platform win32 -- Python 3.8.3, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: C:\Users\simon
plugins: hypothesis-5.16.3, asyncio-0.12.0, cov-2.10.0, forked-1.1.2, xdist-1.32.0
collected 1 item

..\pytest-mypy.py s                                                                                                                                                   [100%] 

============================================================================ 1 skipped in 0.12s ============================================================================ 
$ mypy ~/pytest-mypy.py
C:\Users\simon\pytest-mypy.py:10: error: Attribute function "__call__" with type "Callable[[str, DefaultNamedArg(bool, 'allow_module_level')], NoReturn]" does not accept self argument
C:\Users\simon\pytest-mypy.py:10: error: Too many positional arguments for "skip"
C:\Users\simon\pytest-mypy.py:10: error: Argument 1 to "skip" has incompatible type "str"; expected "bool"
Found 3 errors in 1 file (checked 1 source file)

skip is decorated with @_with_exception(Skipped), will look soon but assuming decorator is not preserving signature

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions