adafruit / Adafruit_CircuitPython_GPS

GPS parsing module for CircuitPython. Meant to parse NMEA data from serial GPS modules.
MIT License
75 stars 58 forks source link

Add unit tests #69

Closed jkittner closed 2 years ago

jkittner commented 2 years ago

Hi, I started implementing some unit tests for this module. I hope this is okay... If I find any bugs during this process, I will send a separate patch and rebase this branch onto the main branch.

As you can see, this is just a draft and still work in progress. I am aiming for full coverage which may take a while.

I am unsure how your licensing conventions work, please let me know if there is something wrong.

tannewt commented 2 years ago

Looks great! Thanks for checking in. I'd love to merge these in. Let's make sure they run in GitHub Actions too.

jkittner commented 2 years ago

thanks, I added a few more tests and also modified gha to run the tests, which seems to work, however I am not sure if this is the way you like them to run and if we want to to tests against different version of (C)Python ?!

tannewt commented 2 years ago

Looks all good to me! I think you have a better understanding of best test practices than I do. Thanks!

jkittner commented 2 years ago

This should be ready for review now. I got up to 90 % coverage, the missing 10 % are mainly caused by the inherited I2C class, where I wasn't able to find a proper way of mocking this without actually having a device connected via I2C -- I am open for any hints here. Some other missing coverage is caused by small one line branches, where I am not even sure, if the case can be ever true?

The CI is failing, because of the bug fixed in #70 which is coverd by one test, so I'd suggest once the bug fix is merged, I will rebase this branch onto master and then it should be ready to merge with a passing CI.

Would you mind adding the hacktoberfest-accepted label to the PRs I made? I'd very much appreciate that 😄