Closed Joonalai closed 9 months ago
@Joonalai thank you for implementing this. Does this mean I need to rename all my fixtures to include 'layer'? Or is there some way to flag them as layers like before? see my old code below.
@pytest.fixture(scope='function')
@clean_qgis_layer
def dem(caseName, qproj):
#retrieve the layer
We decided that it is best to do that automatically in version 2.0. The old marker did not follow pytest philosophy in my opinion and I was not completely happy with it.
So in your case it means that you should rename the fixture to for example dem_layer
.
Do you think yhat there would be still a need for that kind of marker?
I cannot comment on pytest philosophy, but I do think it would be useful to allow users to manually flag and unflag layer fixtures.... and I'm not sure what the downside would be of this feature.
I thought that it would be ugly to import some utility decorator from pytest plugin.
But since you find it handy, I'll re-implement the feature and it should be available to use again in the next release :)
Expected behaviour QGIS layer fixtures should be cleaned automatically without the need of using decoration.
Current behaviour A decoration
clean_qgis_layer
is needed to ensure that the layer is cleared.Describe alternatives you've considered
Additional context Here is a working hook that cleans the layers. One thing to consider though are fixtures with other than function scope.