Skip to content

Changing parametrized tests to be pytest 3.2.0 compatible - #6419

Merged
bsipocz merged 5 commits into
astropy:masterfrom
bsipocz:pytest_3.2.0_compatibility
Aug 30, 2017
Merged

bsipocz merged 5 commits into
astropy:masterfrom
bsipocz:pytest_3.2.0_compatibility

Conversation

@bsipocz

@bsipocz bsipocz commented Aug 2, 2017

Copy link
Copy Markdown
Member

This should fix #6418

However this also makes us incompatible with pytest <3.1.

So overall I'm not sure how to proceed, we definitely need to limit the pytest version in the bugfix branch rather than backport this, but it will probably be fine to release 3.0 with this requirement. The last release incompatible with this change was 3.0.7 and was released on 2017-03-14.

@bsipocz bsipocz added the testing label Aug 2, 2017
@bsipocz bsipocz added this to the v3.0.0 milestone Aug 2, 2017
@astropy-bot

astropy-bot Bot commented Aug 2, 2017 •

Copy link
Copy Markdown

Hi there @bsipocz 👋 - 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 labelled 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! 👍

@astrofrog

Copy link
Copy Markdown
Member

The last release incompatible with this change was 3.0.7 and was released on 2017-03-14

I'm surprised we weren't affected by this sooner, wouldn't have CircleCI started to fail a while back?

@pytest.mark.parametrize('distance', [1000*u.au,
10*u.pc,
pytest.mark.xfail(10*u.kpc),
pytest.mark.xfail(100*u.kpc)])

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.

Ah I see why it worked ;)

@bsipocz

bsipocz commented Aug 2, 2017 •

Copy link
Copy Markdown
Member Author

Nope, they just did the change in pytest 3.2.0 released yesterday (even though they said it to be removed in pytest 4.0). A terribly short deprecation period I would say UPDATE: they haven't removed it yet, but their deprecation warning is raised as exception by us. The weird thing is that it happened during collection, so I haven't though about it as warnings raised as exceptions.

Anyway, this is now failing as circleCI already been set to run in parallel, so your fix is needed, too.

@mhvk

mhvk commented Aug 3, 2017

Copy link
Copy Markdown
Contributor

If we want to be less pytest version dependent, we could just remove these param things altogether and instead add if statements to the tests that do an explicit xfail - perhaps not as elegant, but in a way more readable.

@bsipocz

bsipocz commented Aug 3, 2017

Copy link
Copy Markdown
Member Author

@mhvk - I definitely like that idea for the bugfix branch. For master for 3.0, we may still want to require pytest 3.1+, not just for this issue, but for other slightly annoying warning about the cfg heading.

@mhvk

mhvk commented Aug 3, 2017

Copy link
Copy Markdown
Contributor

Indeed, better to stick with a standard rather than have a workaround for master, so let's require pytest >=3.1 for astropy 3.0.

@bsipocz

bsipocz commented Aug 3, 2017

Copy link
Copy Markdown
Member Author

@astrofrog @eteq - are you OK with the proposed pytest version requirement change for 3.0? #6419 (comment)

@bsipocz

bsipocz commented Aug 3, 2017

Copy link
Copy Markdown
Member Author

Changelog is added. The python3.4 will probably fail as the pytest 3.1 package is not yet built for it. As discussed above this will need a companion PR against the 2.0.x branch that rewrites the tests. I'll open that once the approach here is approved.

@mhvk

mhvk commented Aug 4, 2017

Copy link
Copy Markdown
Contributor

Looks good to me.

@astrofrog astrofrog 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.

That's fine by me but I think you need to update the install_requires to specify this minimum version (and maybe the docs too?)

@bsipocz
bsipocz force-pushed the pytest_3.2.0_compatibility branch from 79a22fc to 3d3e35c Compare August 8, 2017 14:12
bsipocz added a commit to bsipocz/astropy that referenced this pull request Aug 8, 2017
…irect marking of parameters. Bug fix branch counterpart of astropy#6419 to keep supporting pytest <3.1
@bsipocz

bsipocz commented Aug 8, 2017

Copy link
Copy Markdown
Member Author

@astrofrog - This should be ready now. For the bugfix branch fix see #6430.

@mhvk

mhvk commented Aug 8, 2017

Copy link
Copy Markdown
Contributor

This one looks good to me too.

@bsipocz

bsipocz commented Aug 8, 2017

Copy link
Copy Markdown
Member Author

This needs pytest 3.1+ on py3.4 to fix the travis failure. I'll restart the job once it becomes available.

@saimn

saimn commented Aug 29, 2017

Copy link
Copy Markdown
Contributor

While reading pytest documentation, I found a way to filter this pytest warning during collection:

def pytest_collectstart(collector):
    warnings.filterwarnings(
        'ignore',
        message=r"Applying marks directly to parameters is deprecated",
        category=DeprecationWarning)

This could allow to keep pytest < 3.1 compatibility for some time, or maybe just for the maintenance branch ?

@bsipocz

bsipocz commented Aug 29, 2017

Copy link
Copy Markdown
Member Author

@saimn - This is already been fixed in the maintanance branch in #6430.

This PR is basically is hold up only because there is no new enough pytest available for python3.4 and we have been bogged down with some conda build issue.

@saimn

saimn commented Aug 29, 2017

Copy link
Copy Markdown
Contributor

@bsipocz - Ah ok, great !

@bsipocz
bsipocz force-pushed the pytest_3.2.0_compatibility branch from 2c3f266 to c9add19 Compare August 30, 2017 08:06
@bsipocz

bsipocz commented Aug 30, 2017

Copy link
Copy Markdown
Member Author

Merging this now as it's now passing and got the approval long time ago.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test collecting errors with pytest 3.2.0

4 participants