Skip to content

Pytest 8.1.0 AttributeError: 'NoneType' object has no attribute 'setup_method' with staticmethod test #12065

Closed
@anilbey

Description

@anilbey

Hi, the code that was working fine with pytest==8.0.2 started giving the error below for pytest==8.1.0.

Logs with pytest 8.0.2: https://github.com/BlueBrain/BlueCelluLab/actions/runs/8114860416/job/22181464420
Logs with pytest 8.1.0: https://github.com/BlueBrain/BlueCelluLab/actions/runs/8138274377/job/22239015810?pr=142

  request = <SubRequest '_xunit_setup_method_fixture_TestSonataSimulationAccess' for <Function test_init_file_not_found>>
  
      def xunit_setup_method_fixture(request) -> Generator[None, None, None]:
          instance = request.instance
          method = request.function
          if setup_method is not None:
  >           func = getattr(instance, setup_name)
  E           AttributeError: 'NoneType' object has no attribute 'setup_method'
  
  lib/python3.11/site-packages/_pytest/python.py:844: AttributeError

All of the installed dependencies and the system versions are available in the CI logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonpull requests that update Python codetype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions