Skip to content

Fix astropy.io.votable tests that fail when run on installed package - #11677

Merged
pllim merged 1 commit into
astropy:mainfrom
eslavich:eslavich-fix-votable-tests
Apr 30, 2021
Merged

pllim merged 1 commit into
astropy:mainfrom
eslavich:eslavich-fix-votable-tests

Conversation

@eslavich

Copy link
Copy Markdown
Contributor

Description

This pull request is to address failing tests in the astropy.io.votable module when run on non-editable install of astropy. The problem is that setup.cfg doesn't exist in site-packages/astropy, so warnings are not converted to exceptions there. Asserting with pytest.warns works for both editable and non-editable installs.

@pllim pllim added this to the v4.3 milestone Apr 30, 2021
@pllim pllim added Affects-dev PRs and issues that do not impact an existing Astropy release no-changelog-entry-needed testing labels Apr 30, 2021
@pllim

pllim commented Apr 30, 2021

Copy link
Copy Markdown
Member

I don't think the warnings here rely on setup.cfg. verify='exception' option should have turned them into exceptions, no, @tomdonaldson ?

@pllim
pllim requested a review from tomdonaldson April 30, 2021 18:53

# Exercise the checks in __init__
with pytest.raises(AstropyDeprecationWarning):
with pytest.warns(AstropyDeprecationWarning):

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 legit though. ✔️

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

Yes, you are right. It only emits warning and ignores config (unless config tells it to ignore, lol). Fixing that behavior is out of scope.

I didn't notice because I assumed config would be respected and pytest was turning it into error anyway. Good catch!

# Invalid versions
for bversion in (b'1.0', b'2.0'):
with pytest.raises(W21):
with pytest.warns(W21):

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.

vo_warn(W21, config['version'], config, pos)

</VOTABLE>
'''
with pytest.raises(W41):
with pytest.warns(W41):

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.

vo_warn(W41, (correct_ns, data['xmlns']), config, pos)

@pllim
pllim merged commit 339bb16 into astropy:main Apr 30, 2021
@eslavich
eslavich deleted the eslavich-fix-votable-tests branch April 30, 2021 19:47
@tomdonaldson

Copy link
Copy Markdown
Contributor

Thanks @eslavich and @pllim for taking care of this. I learn something new every day!

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

Labels

Affects-dev PRs and issues that do not impact an existing Astropy release io.votable no-changelog-entry-needed testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants