-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
r.coin: added tests for r.coin module #4755
base: main
Are you sure you want to change the base?
Conversation
Are there any more tests that I can perform for this tool? |
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.
I don't know if there is missing something. There is only one test, so testing with all flags and options might be hard to do in a unit test way.
Since you're using pytest, the their assert handling might be enough to not need having a string explaining when it doesn't match. But you don't need to change it, just to know in the future (unless the output wasn't clear enough when you tested it).
Usually, what I consider makes a good test, is tests that you have confidence in to catch your bugs and future bugs. Tests that you have seen fail before, and that passes after. That means you know that the test isn't always passing even if it's not right. I usually like to check that the conditions that make the module fail are tested to fail, so that if ever it passes for no reason, it would be flagged in tests.
You don't need to do the same kind of test for all options. For example, I see that there is an unit
argument, you might want to know that the module correctly accepts them, and rejects others.
But if you feel that what you have is enough, we can go with this for now
For now, the test doesn't run yet in CI, because the file name doesn't match the pattern hardcoded in pyproject.toml. (It bothered me in another PR too). Do you mind testing (locally maybe) if removing that line includes too much files? Line 381 in 7e29f98
Otherwise, change it to match the pytest defaults like explained in
|
@echoix So removing the line is resulting is a lot tests failing and messing up the build. So I placed my test in the I tried calling I am planning to add tests for different units and see if the output consistently updates with changing the |
@wenzeslaus do you have some guidance here? Is it a question of missing a session in pytest, since it is not a Python module, but a C one? @Shreshth-Malik |
Added config file to setup the environment like other tests I ran into. But I am triggering another error in my local system where the session is not passing onto the test file and in the line I will keep looking into it and try to see where it is going wrong. |
@Shreshth-Malik I think this is working now, since #4784 got merged. We can see with code coverage that the new test got correctly run, and there are no failures. Do you still have local errors to solve, or is it ready to go? Was there anything else left to do in this PR currently marked as a draft? |
The test parses the tabular output of
r.coin
, extracts relevant data, and compares it against expected results to ensure accurate calculate of category coincidences.