Closed Joonalai closed 6 months ago
Describe the bug A TypeError: isdeleted() argument 1 must be sip.simplewrapper, not MagicMock is raised when using MagicMock with QgsVectorLayer spec as a fixture with "layer" name.
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not MagicMock
MagicMock
QgsVectorLayer
https://github.com/GispoCoding/pytest-qgis/blob/af7f77aa962175263dcbcbbdce31afeeb6e842e8/src/pytest_qgis/utils.py#L210
To Reproduce Here is a sample test that gives the error (requires pytest-mock plugin, but stdlibs mock can be used as well):
@pytest.fixture() def stub_layer( mocker, ) -> MagicMock: return mocker.MagicMock( spec=QgsVectorLayer, autospec=True, ) def test_stub_layer(stub_layer): assert isinstance(stub_layer, QgsVectorLayer)
Expected behavior Cleaning should ignore mocks.
Environment (please complete the following information):
Describe the bug A
TypeError: isdeleted() argument 1 must be sip.simplewrapper, not MagicMock
is raised when usingMagicMock
withQgsVectorLayer
spec as a fixture with "layer" name.https://github.com/GispoCoding/pytest-qgis/blob/af7f77aa962175263dcbcbbdce31afeeb6e842e8/src/pytest_qgis/utils.py#L210
To Reproduce Here is a sample test that gives the error (requires pytest-mock plugin, but stdlibs mock can be used as well):
Expected behavior Cleaning should ignore mocks.
Environment (please complete the following information):