Closed Joonalai closed 2 months ago
@LKajan, @ismogis could you review this?
I think this kind of approach would indeed be cleaner than figuring by the function name the need for layer cleaning.
This particular implementation seems to fail in cases where the layer fixture is using yield:
@pytest.fixture()
@clean_qgis_layer
def layer():
layer = QgsLayer(...)
yield layer
print(f"teardown layer {layer}")
Could you find some alternative way for the implementation?
Have you studied what actually is causing these seg faults? Is it possible to fix the root cause instead?
Attention: Patch coverage is 66.66667%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 57.53%. Comparing base (
d782092
) to head (a466e4c
).
Files | Patch % | Lines |
---|---|---|
src/pytest_qgis/utils.py | 66.66% | 3 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
I added a mention that this doesn't work with fixtures that yield for now and made typing more precise. With these changes I think it is ok to merge until we find a better solution to make sure map layers don't cause seg faults.
This PR:
clean_qgis_layer
decorator back since it has been requested