Skip to content

Error "doubles.exceptions.VerifyingBuiltinDoubleArgumentError: unsupported callable" #150

@arnlen

Description

@arnlen

Context

Every time I try to mock a function from an external library (depthai in my case), I got the following error:

ValueError: no signature found for builtin <instancemethod getIrDrivers at 0x102b0b400>

/usr/local/Cellar/python@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py:2328: ValueError

The above exception was the direct cause of the following exception: [...]

TypeError: unsupported callable

During handling of the above exception, another exception occurred: [...]

doubles.exceptions.VerifyingBuiltinDoubleArgumentError: unsupported callable

What I tried

In the FAQ, I read this section which explains how to bypass the inspection functionality, by using with no_builtin_verification().

This is what I tried, by it doesn't fix the issue.

My code

import depthai as dai

from models.device import Device
from doubles import InstanceDouble, allow, no_builtin_verification
import functools

class TestDevice:

    with no_builtin_verification():
        allow(functools).reduce

        def test_when_camera_has_no_ir_projector(self):
            dai_device = InstanceDouble('depthai.Device')
            allow(dai_device).getIrDrivers.and_return([])

            device = Device(dai_device, 300)
            assert device.dai_device == dai_device

Setup

  • Platform: MacOS
  • Python 3.11.5
  • pytest-7.4.2, pluggy-1.3.0
  • doubles-1.5.3

Any idea?
I'm even sure if I'm using the with no_builtin_verification() properly.' 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions