-
Notifications
You must be signed in to change notification settings - Fork 224
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
Allow printing show_versions() to in-memory buffer to enable testing #2399
Conversation
To increase code coverage of `__init__.py`, check the output of `pygmt.show_versions()` that is printed to an in-memory string buffer instead of stdout. Adapted from https://github.com/xarray-contrib/xbatcher/blob/v0.2.0/xbatcher/tests/test_print_versions.py
Also made the docstring for test_show_versions() a bit more descriptive.
Code coverage report for this PR is at https://app.codecov.io/gh/GenericMappingTools/pygmt/pull/2399. The coverage for |
Looks great! There is a unrelated CI failure, which is likely caused by recent upstream changes like GenericMappingTools/gmt#7295
|
Reported in GenericMappingTools/gmt#7295 (comment) |
Description of proposed changes
To increase code coverage of
__init__.py
, check the output ofpygmt.show_versions()
that is printed to an in-memory string buffer instead of stdout.Adapted from https://github.com/xarray-contrib/xbatcher/blob/v0.2.0/xbatcher/tests/test_print_versions.py. Was looking through some code in
xbatcher
and noticed the neatprint(..., file=io.StringIO)
trick. Thanks @maxrjones!Patches code coverage since #466
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version