-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test to prevent regressions if BadLayerHandler
does not work during packaging
or process_projectfile
#1089
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gounux in case you did not use already, please install https://plugins.qgis.org/plugins/trackable_project_files/ to make the .qgs
file git trackable.
BadLayerHandler
does not work during packaging
or process_projectfile
BadLayerHandler
does not work during packaging
or process_projectfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments on the test.
Co-authored-by: Ivan Ivanov <[email protected]>
Co-authored-by: Ivan Ivanov <[email protected]>
self.assertFalse(invalid_localized_layer["is_valid"]) | ||
self.assertTrue(invalid_localized_layer["is_localized"]) | ||
self.assertEquals( | ||
invalid_localized_layer["error_code"], "localized_dataprovider" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you define:
def assertLayerData(self, layer_data: dict, is_valid: bool, is_localized: bool, error_code: str):
self.assertEquals(layer_data["is_valid"], is_valid)
self.assertEquals(layer_data["is_localized"], is_localized)
self.assertEquals(layer_data["error_code"], error_code)
You can simplify the code and improve readability to something like:
self.assertFalse(invalid_localized_layer["is_valid"]) | |
self.assertTrue(invalid_localized_layer["is_localized"]) | |
self.assertEquals( | |
invalid_localized_layer["error_code"], "localized_dataprovider" | |
) | |
self.assertLayerData( | |
processfile_layers["invalid_localized_polygon_layer_id"], | |
False, | |
True, | |
"localized_dataprovider", | |
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion ! Indeed it makes things more simple.
I've actually been using parameters keywords when calling the function, for more readability, like this :
self.assertLayerData(
processfile_layers["invalid_localized_polygon_layer_id"],
is_valid=False,
is_localized=True,
error_code="localized_dataprovider",
)
What do you think ?
This PR will :
simple_bumblebees_wrong_localized.qgs
QGIS project file with 3 layers :PROCESS_PROJECTFILE
type job parses the layer data correctlyPACKAGE
type job parses the layer data correctly