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

Use assert_quantity_allclose from Astropy #306

Merged
merged 3 commits into from Jul 21, 2015

Conversation

Projects
None yet
2 participants
@mapazarr
Member

mapazarr commented Jul 21, 2015

This function: gammapy.utils.testing.assert_quantity seems to be a duplication of astropy.tests.helper.assert_quantity_allclose. Maybe we don't need it?

If changed/removed, the docs here should be updated too: http://gammapy.readthedocs.org/en/latest/development/index.html
(the entry for the assert section (at the end of the mentioned page) is as of now missing, because it is being added in PR #299, still not merged).

Triggered by this astropy issue: astropy/astropy#3978

@mapazarr mapazarr referenced this pull request Jul 20, 2015

Merged

Add cube background model class #299

8 of 8 tasks complete

@cdeil cdeil added the question label Jul 20, 2015

@cdeil cdeil added this to the 0.3 milestone Jul 20, 2015

@cdeil cdeil self-assigned this Jul 20, 2015

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 20, 2015

Member

@mapazarr – Yes. Please remove the version from Gammapy and replace all callers (if any) with the version from Astropy.
There's a ton of stuff in Gammapy that has become available in Astropy or affiliated packages like reproject, photutils, ... in the past two years and should be cleaned up. It's great if you help with this.

Some suggestions for the future to make issues / PRs quicker to review for maintainers in the future:

  • Link in the issue / PR description to the relevant docs or code. In this case the astropy.tests.helper.assert_quantity_allclose and gammapy.utils.testing.assert_quantity functions.
  • There's a command line tool called hub that lets you turn a Github issue into a pull request. Make a branch, push it to your fork and then run the hub pull-request -i XXX command. I often use this to attach a solution to an issue, instead of opening a separate pull request and spreading the discussion across two places. Maybe give it a try with this issue?
Member

cdeil commented Jul 20, 2015

@mapazarr – Yes. Please remove the version from Gammapy and replace all callers (if any) with the version from Astropy.
There's a ton of stuff in Gammapy that has become available in Astropy or affiliated packages like reproject, photutils, ... in the past two years and should be cleaned up. It's great if you help with this.

Some suggestions for the future to make issues / PRs quicker to review for maintainers in the future:

  • Link in the issue / PR description to the relevant docs or code. In this case the astropy.tests.helper.assert_quantity_allclose and gammapy.utils.testing.assert_quantity functions.
  • There's a command line tool called hub that lets you turn a Github issue into a pull request. Make a branch, push it to your fork and then run the hub pull-request -i XXX command. I often use this to attach a solution to an issue, instead of opening a separate pull request and spreading the discussion across two places. Maybe give it a try with this issue?
@mapazarr

This comment has been minimized.

Show comment
Hide comment
@mapazarr

mapazarr Jul 20, 2015

Member

Ok, assign it to me please.

Member

mapazarr commented Jul 20, 2015

Ok, assign it to me please.

@cdeil cdeil assigned mapazarr and unassigned cdeil Jul 20, 2015

@mapazarr

This comment has been minimized.

Show comment
Hide comment
@mapazarr

mapazarr Jul 21, 2015

Member

@cdeil I used the hub command as suggested, and I get:
Warning: Issue to pull request conversion is deprecated and might not work in the future.
So maybe another solution should be found in the future for converting issues into PRs.

Member

mapazarr commented Jul 21, 2015

@cdeil I used the hub command as suggested, and I get:
Warning: Issue to pull request conversion is deprecated and might not work in the future.
So maybe another solution should be found in the future for converting issues into PRs.

assert actual.unit == desired.unit
assert_allclose(actual, desired, *args, **kwargs)
__all__ = []

This comment has been minimized.

@mapazarr

mapazarr Jul 21, 2015

Member

This file is now basically empty: no methods are defined. Should we:

  • keep it in case we need to implement custom tests in the future?
  • or should we remove it?
@mapazarr

mapazarr Jul 21, 2015

Member

This file is now basically empty: no methods are defined. Should we:

  • keep it in case we need to implement custom tests in the future?
  • or should we remove it?

This comment has been minimized.

@cdeil

cdeil Jul 21, 2015

Member

Just remove it for now ... we can always add it back later if we need it.
There might also be a Sphinx automodapi directive you have to remove in the docs.
And you can use the Github full-text search to make sure you've replaced all the callers (test coverage in Gammapy is so bad that you can't rely on tests passing)

@cdeil

cdeil Jul 21, 2015

Member

Just remove it for now ... we can always add it back later if we need it.
There might also be a Sphinx automodapi directive you have to remove in the docs.
And you can use the Github full-text search to make sure you've replaced all the callers (test coverage in Gammapy is so bad that you can't rely on tests passing)

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 21, 2015

Member

I've been getting that hub warning for years now.
I don't know why Github has deprecated that procedure of turning issues into PRs, I think it's very nice to have issue report, discussion and solution in one ticket instead of two.

Member

cdeil commented Jul 21, 2015

I've been getting that hub warning for years now.
I don't know why Github has deprecated that procedure of turning issues into PRs, I think it's very nice to have issue report, discussion and solution in one ticket instead of two.

Show outdated Hide outdated docs/development/index.rst Outdated
Show outdated Hide outdated gammapy/datasets/tests/test_fermi.py Outdated
Show outdated Hide outdated gammapy/datasets/tests/test_fermi.py Outdated

@cdeil cdeil changed the title from assert_quantity might be a duplication of assert_quantity_allclose to Use assert_quantity_allclose from Astropy Jul 21, 2015

@cdeil cdeil added cleanup tests and removed question labels Jul 21, 2015

@cdeil cdeil assigned cdeil and unassigned mapazarr Jul 21, 2015

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 21, 2015

Member

I've left some minor comments ... once these are addressed this is OK.

I've also changed the title of the PR and the labels.
As assignee I've put myself following the Astropy workflow of putting the person that does the main review and eventually will hit the merge button.
For issues it makes sense to put the implementer and I'm sometimes doing this, though.
Not 100% sure what the best workflow is here, but Gammapy is still a pretty small project and it doesn't matter much.

Member

cdeil commented Jul 21, 2015

I've left some minor comments ... once these are addressed this is OK.

I've also changed the title of the PR and the labels.
As assignee I've put myself following the Astropy workflow of putting the person that does the main review and eventually will hit the merge button.
For issues it makes sense to put the implementer and I'm sometimes doing this, though.
Not 100% sure what the best workflow is here, but Gammapy is still a pretty small project and it doesn't matter much.

@mapazarr

This comment has been minimized.

Show comment
Hide comment
@mapazarr

mapazarr Jul 21, 2015

Member

Isn't it possible to add 2 assignee? The one implementing the changes and the one reviewing them?

Anyway. I implemented the changes.

Member

mapazarr commented Jul 21, 2015

Isn't it possible to add 2 assignee? The one implementing the changes and the one reviewing them?

Anyway. I implemented the changes.

cdeil added a commit that referenced this pull request Jul 21, 2015

Merge pull request #306 from mapazarr/assert_quantity_cleanup
Use assert_quantity_allclose from Astropy

@cdeil cdeil merged commit 7f94830 into gammapy:master Jul 21, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 21, 2015

Member

There's only 1 assignee possible.
The Github issue / PR system is intentionally kept super-simple (compared to other issue trackers like e.g. JIRA that we use in HESS).
This simplicity is great 99% of the time, but sometimes more options or customisation would be nice to have...

Member

cdeil commented Jul 21, 2015

There's only 1 assignee possible.
The Github issue / PR system is intentionally kept super-simple (compared to other issue trackers like e.g. JIRA that we use in HESS).
This simplicity is great 99% of the time, but sometimes more options or customisation would be nice to have...

@cdeil

This comment has been minimized.

Show comment
Hide comment
@cdeil

cdeil Jul 21, 2015

Member

Thanks!

Member

cdeil commented Jul 21, 2015

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment