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

Improve error message with wrong xspec version #422

Merged

Conversation

olaurino
Copy link
Member

@olaurino olaurino commented Dec 15, 2017

Improve the handling of XSPEC versions mismatch.

@@ -93,4 +95,5 @@ class version_at_least(include_if):
the xspec version detected at runtime is equal or greater than the one provided to the decorator.
"""
def __init__(self, version_string):
include_if.__init__(self, _xspec.get_xsversion() >= version_string)
xspec_version = LooseVersion(_xspec.get_xsversion())
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to make xspec_version a module-level "constant", since it shouldn't be something that changes within a test run?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@olaurino olaurino force-pushed the improve-error-message-for-xspec-version branch from e2b531b to 7c46945 Compare December 18, 2017 16:05
@DougBurke
Copy link
Contributor

Should there be an explicit check of this message in the tests? In other words, a test with a hard-coded knowledge of what the error message should look like. The idea being that if the error message text is changed, we will get a test failure, which would then let us know to update any accompanying documentation. For this particular test it is likely overkill.

@olaurino
Copy link
Member Author

Should there be an explicit check of this message in the tests?

Yes, that's why this is still WIP and I didn't update the description. I need to make sure it's actually working whether it's through a unit test of even just a local test. I don't even know whether that line is being hit during the tests. I'll get to it asap.

@olaurino olaurino added this to the 4.10.1 milestone Sep 4, 2018
@olaurino
Copy link
Member Author

Rebasing to resolve conflicts and get the latest changes from master (was ffc4cc4)

@olaurino olaurino force-pushed the improve-error-message-for-xspec-version branch 2 times, most recently from 61da465 to 765fe8f Compare September 11, 2018 13:36
@DougBurke
Copy link
Contributor

@olaurino - is this something you want reviewing or are you still looking at the test issue (mentioned in #422 (comment) )?

@olaurino
Copy link
Member Author

I was hoping I could test this, even just interactively, I just haven't had any time to do it.

Copy link
Contributor

@DougBurke DougBurke left a comment

Choose a reason for hiding this comment

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

I'm happy to have these merged with or without the tests Omar wanted to do.

@olaurino olaurino changed the title Improve error message for xspec version Improve error message with wrong xspec version Sep 20, 2018
@olaurino olaurino force-pushed the improve-error-message-for-xspec-version branch from 765fe8f to 77db1c5 Compare September 20, 2018 14:00
@olaurino olaurino merged commit 77db1c5 into sherpa:master Sep 21, 2018
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.

None yet

2 participants