Skip to content

Conversation

@moink
Copy link
Contributor

@moink moink commented Dec 30, 2020

This pull request partially addresses xref #30999 to remove bare pytest.raises by adding match=msg. It doesn't close that issue as I have only addressed test modules in the pandas/tests/reshape/ directory.

This one was super simple. Fixed 5 bare pytest.raises and didn't do anything complicated or controversial.

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@moink moink changed the title Add match=msg to all pytest.raises in pandas/tests/reshape TST: GH30999 Add match=msg to all pytest.raises in pandas/tests/reshape Dec 30, 2020
@moink
Copy link
Contributor Author

moink commented Dec 30, 2020

Pretty sure the CI failure has nothing to do with the changes:

def _assert_caught_no_extra_warnings(
        *,
        caught_warnings: Sequence[warnings.WarningMessage],
        expected_warning: Optional[Union[Type[Warning], bool]],
    ) -> None:
        """Assert that no extra warnings apart from the expected ones are caught."""
        extra_warnings = []
    
        for actual_warning in caught_warnings:
            if _is_unexpected_warning(actual_warning, expected_warning):
                extra_warnings.append(
                    (
                        actual_warning.category.__name__,
                        actual_warning.message,
                        actual_warning.filename,
                        actual_warning.lineno,
                    )
                )
    
        if extra_warnings:
>           raise AssertionError(f"Caused unexpected warning(s): {repr(extra_warnings)}")
E           AssertionError: Caused unexpected warning(s): [('ResourceWarning', ResourceWarning("unclosed <socket.socket fd=8, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('10.1.0.4', 36820), raddr=('169.254.169.254', 80)>"), '/home/vsts/work/1/s/pandas/io/parsers.py', 2952)]

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Code Style Code style, linting, code_checks labels Dec 30, 2020
@jreback jreback added this to the 1.3 milestone Dec 30, 2020
@jreback jreback merged commit f5ef132 into pandas-dev:master Dec 30, 2020
@jreback
Copy link
Contributor

jreback commented Dec 30, 2020

thanks @moink

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Style Code style, linting, code_checks Error Reporting Incorrect or improved errors from pandas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants