Skip to content

Add new pytest plugins as extern packages to v2.0.x series - #6918

Merged
bsipocz merged 20 commits into
astropy:v2.0.xfrom
drdavella:pytest-plugin-extern
Dec 9, 2017
Merged

bsipocz merged 20 commits into
astropy:v2.0.xfrom
drdavella:pytest-plugin-extern

Conversation

@drdavella

Copy link
Copy Markdown
Contributor

This is an alternative approach to #6833 for providing compatibility with pytest-astropy for the v2.0.x series. It adds the new pytest plugins as extern packages. I believe this is a cleaner approach and it appears to work better 🤞.

Thanks to @eteq for the idea.

@astropy-bot

astropy-bot Bot commented Nov 30, 2017 •

Copy link
Copy Markdown

Hi there @drdavella 👋 - thanks for the pull request! I'm just a friendly 🤖 that checks for issues related to the changelog and making sure that this pull request is milestoned and labeled correctly. This is mainly intended for the maintainers, so if you are not a maintainer you can ignore this, and a maintainer will let you know if any action is required on your part 😃.

Everything looks good from my point of view! 👍

If there are any issues with this message, please report them here.

@drdavella drdavella added this to the v2.0.3 milestone Nov 30, 2017
Comment thread .travis.yml
env: SETUP_CMD='test --coverage --remote-data=astropy -a "--mpl"'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
PIP_DEPENDENCIES='cpp-coveralls objgraph jplephem pytest-mpl bintrees'
PIP_DEPENDENCIES='cpp-coveralls objgraph jplephem pytest-astropy pytest-mpl bintrees'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

no need for pytest-mpl here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, the pytest-mpl dependency actually isn't in a released version of pytest-astropy yet.

@bsipocz bsipocz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I find this approach much more clean and probably better maintainable.

Comment thread CHANGES.rst Outdated
- Fixed a bug that meant that the data.astropy.org mirror could not be used when
using --remote-data=astropy. [#6724]

- Support compatibility with new ``pytest-astropy`` plugins. [#6918]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please add the version number of pytest-astropy that's being bundled in here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The external plugins are actually straight from the master branches of the repositories right now. Can I update and provide this with the next release of pytest-astropy?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes, that sounds good. That case it can go to the bottom under "Other Changes"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with @bsipocz here - we should tie this to a specific pytest-astropy release so affiliated package devs can be sure how to map this onto the "stand-alone" version.

@drdavella

Copy link
Copy Markdown
Contributor Author

CircleCI build looks like it choked. Can someone restart?

@drdavella

Copy link
Copy Markdown
Contributor Author

Ideally we would do this with submodules since it would make it easier to keep up-to-date. However, that means more infrastructure to support, which is maybe not worth it.

@bsipocz

bsipocz commented Nov 30, 2017

Copy link
Copy Markdown
Member

I don't think it's particularly worth doing submodules here, we just make sure to update to the latest pytest-astropy before doing a release.

@drdavella

Copy link
Copy Markdown
Contributor Author

Current test failures on Py27 appear to be unrelated. Test failures against numpy-1.9 need to be addressed.

@drdavella
drdavella force-pushed the pytest-plugin-extern branch from 31f3636 to 136b997 Compare December 1, 2017 01:31
@drdavella

drdavella commented Dec 1, 2017 •

Copy link
Copy Markdown
Contributor Author

@mhvk any ideas about how to account for the behavior of equal_nan with older versions of numpy? Originally I backported the change to use equal_nan in pytest-doctestplus, but it fails against numpy-1.9 and earlier. However, removing equal_nan means we fail against tests where nans are compared.

Comment thread .travis.yml
- os: linux
env: PYTHON_VERSION=2.7 SETUP_CMD='test --remote-data=astropy -a "--mpl"'
CONDA_DEPENDENCIES=$CONDA_ALL_DEPENDENCIES
CONDA_DEPENDENCIES="`echo $CONDA_ALL_DEPENDENCIES mkl=11.3.3`"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe you already tried this but I think it should be possible to just do:

CONDA_DEPENDENCIES="$CONDA_ALL_DEPENDENCIES mkl=11.3.3"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I tried it (I've tried a few variants), and it picked up mkl as a separate env variable

@eteq

eteq commented Dec 6, 2017

Copy link
Copy Markdown
Member

I can confirm this fixes the affiliated package test() problem, at least (which was some of the motivation for #6833). Will try to review this a bit more later, but my initial reaction is that it looks like the best solution!

@eteq eteq left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall this looks good. I tested both <package>.test() and python setup.py test for this version with several affiliated packages and it seems to run without a hitch.

Just one new comment here to add a note in the changelog. But I think this should wait on merge until there's a specific version of pytest-astropy that it can be tied to? I think that means just tagging releases on pytest-astropy and any relevant contained packages and then updating the changelog, though, right @drdavella ?

Comment thread CHANGES.rst Outdated
- Fixed a bug that meant that the data.astropy.org mirror could not be used when
using --remote-data=astropy. [#6724]

- Support compatibility with new ``pytest-astropy`` plugins. [#6918]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree with @bsipocz here - we should tie this to a specific pytest-astropy release so affiliated package devs can be sure how to map this onto the "stand-alone" version.


def pytest_addoption(parser):

parser.addoption('--repeat', action='store',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is technically a "new feature" in the 2.0.x series, right? I think that should be mentioned in the changelog. I think it's justifiable in a 2.0.x release given that it's really tied to the testing architecture, but it should be mentioned rather than silently appearing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is actually available in v2.0.2, so I don't think any action is required:

parser.addoption('--repeat', action='store',
help='Number of times to repeat each test')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh my mistake. all good then

@eteq

eteq commented Dec 7, 2017 •

Copy link
Copy Markdown
Member

To pass on the results of some Slack discussion here: if possible we'll wait for the new pytest-astropy release to merge this so that it can include the relevant version number. But we don't want to delay this PR too long (since this fixes the tests on 2.0.x), so if that takes more than a day or so we might merge this and have a follow-on PR add the version numbers.

@drdavella

Copy link
Copy Markdown
Contributor Author

@eteq, @bsipocz should be ready to go now. I released pytest-astropy-0.2.0 just now, so hopefully everything is in order.

# plugin since we need to support older versions of numpy that
# do not provide the 'equal_nan' argument, which was added in
# numpy-1.10.
if np.isnan(ngf) and np.isnan(nwf):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks OK, except just to be sure: since this is for astropy itself, we can just import NUMPY_LT_1_10 from astropy.utils.compat somewhere above and do if NUMPY_LT_1_10 and np.isnan(ngf) and np.isnan(nwf):
-- that way we don't slow down the rest and also have an easier time removing this if it is no longer necessary.

@drdavella

Copy link
Copy Markdown
Contributor Author

I'm not sure what's up with the current test failures on travis.

@pllim

pllim commented Dec 8, 2017 •

Copy link
Copy Markdown
Member

I might have an idea. Experimental PR forthcoming... ???

@eteq

eteq commented Dec 8, 2017

Copy link
Copy Markdown
Member

FWIW, I'm now happy with this once the tests are passing. (:crossed_fingers: that @pllim is fixing it...)

@pllim

pllim commented Dec 8, 2017

Copy link
Copy Markdown
Member

Ahaha... Ops. I now see the that failures here are different. I was thinking of #6942. I'll have a look here too, I guess.

@pllim

pllim commented Dec 8, 2017

Copy link
Copy Markdown
Member

Numpy is too old (1.9). broadcast_to is new in Numpy 1.10.

@drdavella

Copy link
Copy Markdown
Contributor Author

Current test failures should be fixed by #6953. I'm not sure why they started showing up just now. @bsipocz did you rebase on the latest v2.0.x branch?

@pllim

pllim commented Dec 8, 2017 •

Copy link
Copy Markdown
Member

There is still this failure but it is not obvious to me what the fix should be -- In test_unicode_sandwich_compare[str-MaskedColumn] and test_unicode_sandwich_compare[str-Column] (not related to this PR)

>       assert np.all((obj2 == obj1) == [True, False])
E       AssertionError

@drdavella

Copy link
Copy Markdown
Contributor Author

@pllim I think @bsipocz has already fixed that one in another PR: #6943

@bsipocz
bsipocz merged commit 90c23cc into astropy:v2.0.x Dec 9, 2017
@bsipocz

bsipocz commented Dec 9, 2017

Copy link
Copy Markdown
Member

Thanks @drdavella! The failures are supposed to be worked around already in 2.0.x, so I took the liberty to merge this now.

@drdavella
drdavella deleted the pytest-plugin-extern branch December 11, 2017 14:15
from ....utils.compat import NUMPY_LT_1_10


_ALLCLOSE_KWARGS = {}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually we shouldn't do this and any of the numpy compatibility here. anything in externs should be verbatim of an external package release (maybe with the exception of the six imports).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's a little awkward in this case because I'm not sure we want to have to support numpy<1.10 in the plugin itself, but this was necessary in order to get the backport to work. You make a very good point, though. I'm not sure what the right solution is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

well, I'm not sure we will be able to drop that support for the LTS, so that case two version need to be maintained

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okay, I guess we might as well add this to the plugin itself then.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants