Skip to content

CLN/BUG: Allow assert_produces_warning to raise during an exception #50614

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

Merged
merged 11 commits into from
Jan 13, 2023

Conversation

mroeschke
Copy link
Member

Fixes this case that would not raise an AssertionError before

with pytest.raises(...):
    with tm.assert_produces_warning(UserWarning):
        raise ...

@mroeschke mroeschke added Clean Warnings Warnings that appear or should be added to pandas labels Jan 7, 2023
@gfyoung
Copy link
Member

gfyoung commented Jan 7, 2023

CI/CD notwithstanding, I'm having some trouble reviewing this PR. It seems there are changes beyond the scope of the title?

IMO could benefit from breaking apart into smaller ones unless I'm missing something @mroeschke.

@mroeschke
Copy link
Member Author

There is an attribute cleanup and doc change in this PR, but otherwise the other changes correspond to assert_produces_warning now evaluating during exceptions. The changed tests have stale assert_produces_warnings that are testing that an exception is raised

@mroeschke mroeschke added this to the 2.0 milestone Jan 12, 2023
@mroeschke mroeschke merged commit 9991d5e into pandas-dev:main Jan 13, 2023
@mroeschke mroeschke deleted the cln/old_depr branch January 13, 2023 00:19
phofl pushed a commit to phofl/pandas that referenced this pull request Jan 13, 2023
…andas-dev#50614)

* Remove old deprecations, make assert_produces_warning check when exceptions are raised

* cleanup more tests, add test for change

* Add more thorough tests

* Fix other uncessary warnings

* Fix min version pyarrow tests

* Fix for 32 bit build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Warnings Warnings that appear or should be added to pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants