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

Set GMT_COMPATIBILITY to 6 when pygmt session starts #432

Merged
merged 8 commits into from
May 21, 2020
Merged

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented May 17, 2020

Description of proposed changes

To prevent users getting "pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6". Overrides GMT_COMPATIBILITY setting in users gmt.conf file.

Fixes #428, #365

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If adding new functionality, add an example to docstrings or tutorials.

weiji14 added 2 commits May 17, 2020 21:35
To prevent users getting "pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6".
Prevents regression of pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6. Contains setup, test and teardown of a mock session where the user has a gmt.conf file with GMT_COMPATIBILITY = 5.
@weiji14 weiji14 requested a review from a team May 17, 2020 12:46
Comment on lines 51 to 52
assert os.path.exists("gmt.conf")
os.remove("gmt.conf")
Copy link
Member

Choose a reason for hiding this comment

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

I don't think there is a "gmt.conf" file in the current directory. It should be in the temporary gmt session directory.

Copy link
Member Author

Choose a reason for hiding this comment

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

I kinda agree, but wouldn't the assertion fail if there isn't a gmt.conf file? 😕 Things got really confusing for me when I was designing this test with gmt.conf files all over the place, one kept popping up in my pygmt folder with GMT_COMPATIBILITY 5 for some reason.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, you're right, it's in "/home/.../pygmt/tmp-test-dir-with-unique-name/gmt.conf". I'll remove these lines once the tests on Windows pass in the other PR.

Copy link
Member

Choose a reason for hiding this comment

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

I still don't understand why the test works, but since the test pass, OK to merge.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it's a complicated test. but removing the line at

lib.call_module("set", "GMT_COMPATIBILITY 6")
should fail this test, as encountered by Mark.

@weiji14
Copy link
Member Author

weiji14 commented May 20, 2020

@MarkWieczorek, do you want to test this branch (using pip install https://github.com/GenericMappingTools/pygmt/archive/gmt_compat_6.zip)? Just want to make sure that it fixes your issue.

@MarkWieczorek
Copy link
Contributor

It works!

@weiji14 weiji14 added this to the 0.1.x milestone May 20, 2020
weiji14 added 2 commits May 21, 2020 15:15
Because it's in a temporary pygmt session folder anyway.
@weiji14 weiji14 merged commit e018f21 into master May 21, 2020
@weiji14 weiji14 deleted the gmt_compat_6 branch May 21, 2020 03:49
@weiji14 weiji14 mentioned this pull request May 25, 2020
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pygmt-session [ERROR]: GMT_COMPATIBILITY: Expects values from 6 to 6; reset to 6.
3 participants