Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds first cut at a test suite for the
SerialTransfer
andCRC
classes. It only provides ~85% coverage in total (~90% forCRC.py
and 84% forpySerialTransfer.py
). In part this is due to not covering the non core library functionality i.e. the crc__name__ == "__main__"
code and the helper functions such asmsb
,lsb
etc.The coverage is not the full story though, obviously. There are definitely untested code paths here also (which can be seen if pytest is run with coverage turned on), so there are definitely areas for improvement. This feels like a good start however, and I think will go some way to providing a defence against regressions when extending or refactoring the functionality of the library.
It's also worth noting that the content of the tests themselves probably wants reviewing to double check that the things i am asserting in the tests are actually correct, as the'll be treated as the source of truth. As you did all the excellent work in the first plaec, you'll be well placed to point out where i've made stupid mistakes :-).
Note: I have added
pytest
,pytest-mock
, andpytest-cov
as dev dependencies. In order to run the tests, it is necessary to perform an editable install of the package, passing the extra[dev]
qualifier e.g.pip install -e .[dev]
. Tests can then be run with justpytest
, or with coverage enabled withpytest --cov .\pySerialTransfer
Addresses #89