-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
TST: Sort test parametrization in cosmology #16191
TST: Sort test parametrization in cosmology #16191
Conversation
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
@@ -697,7 +697,7 @@ def test_Otot0(self, cosmo): | |||
|
|||
@pytest.mark.skipif(not HAS_SCIPY, reason="scipy is not installed") | |||
@pytest.mark.parametrize("z, exc", invalid_zs) | |||
@pytest.mark.parametrize("method", _FLRW_redshift_methods) | |||
@pytest.mark.parametrize("method", sorted(_FLRW_redshift_methods)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just have _FLRW_redshift_methods
be a list in the first place by applying the sort here?
astropy/astropy/cosmology/tests/helper.py
Line 78 in 9ebf44a
return methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially tried that, but the generated set is modified in a number of tests where redshift methods are removed. See the rest of the diff.
Turning the resulting set into a sorted list was the simplest solution, and it is done elsewhere in the code base. For example, here:
@pytest.mark.parametrize("method", sorted(set(METHODS) - {"bootstrap"})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that maybe these tests are a little over-engineered but that is neither here nor there. Let's get this in as-is then. Really appreciate your help. Thanks!
I will see if auto-backport works. If not, then we will just not backport it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice, thanks for getting to the bottom of this !
…191-on-v6.0.x Backport PR #16191 on branch v6.0.x (TST: Sort test parametrization in cosmology)
Description
This PR fixes an issue where test parametrizations in the cosmology subpackage were passed as sets, which are inherently unsorted. They need to be sorted if one is to use
pytest-xdist
. This converts them to sorted lists, as is done elsewhere in Astropy.Fixes #16190