-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Here's software development lesson 2: Write tests.
You have fixed the problem where the different rasters do not align. But currently, there's no protection that this does not happen again due to some code changes that may happen in the future. So what's often done is to write tests to ensure these problems don't come back and that you didn't f**k up the code with your changes.
An example can be found here: https://github.com/PUTvision/qgis-plugin-deepness/tree/devel/test
I won't go into much detail, but the general idea is this: You make a separate directory "test". There you can put a small laz file that previously had problems. Then you create a file that imports e.g. the pre-processing functionality, runs it on the file and performs some checks, e.g. that the different output layers are all of the same size. You could also have a second file that does the inference and compares it to some reference file that you have visually checked to be ok. The standard testing framework is pytest. You would then run the tests before you commit, or before you merge a pull request (PR).
This makes things more cumbersome again, but again increases the code quality and saves you from trouble down the line.