Skip to content
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

grass.gunittest: Allow floating point for --min-success argument #5278

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

echoix
Copy link
Member

@echoix echoix commented Mar 4, 2025

Making gunittest accept floating points for --min-success was a one word change, and already worked correctly.

I just followed up by making the percentage displayed with a decimal point, and extracting the repeated nested function as noted in a todo note; they were exactly the same and didn't use anything from the outer context, both were "pure functions", and could've been static functions in other languages.

I tried it out on the vector folder, making sure I didn't compile with some required libraries so some tests would fail (for example, no pdal, so v.in.lidar and v.in.pdal would fail)

For 19/31=0.6129032258064516, using 66.7 fails:

grass --tmp-project XY --exec     python3 -m grass.gunittest.main     --grassdata $HOME --location nc_spm_full_v2alpha2 --location-type nc     --min-success 66.7

image

For 19/31=0.6129032258064516, using 61.2 passes:

grass --tmp-project XY --exec     python3 -m grass.gunittest.main     --grassdata $HOME --location nc_spm_full_v2alpha2 --location-type nc     --min-success 61.2

image

@github-actions github-actions bot added Python Related code is in Python libraries labels Mar 4, 2025
@echoix echoix changed the title gunittest: Allow floating point for --min-success argument grass.gunittest: Allow floating point for --min-success argument Mar 4, 2025
@echoix
Copy link
Member Author

echoix commented Mar 4, 2025

@nilason With that will be able to use any fractional percent for the success rate, instead of using a smaller truncated integer

Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Good to see the duplicated code go too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libraries Python Related code is in Python
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants