Skip to content

STYLE add vulture hook #45173

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 2 commits into from
Jan 5, 2022
Merged

STYLE add vulture hook #45173

merged 2 commits into from
Jan 5, 2022

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Jan 3, 2022

xref #27396

The return in pandas/tests/io/test_common.py was added in #39777 - @twoertwein are the two lines which come after it meant to be skipped?

The return; yield comes from #12032 - the proposed change achieves the same thing (taken from https://stackoverflow.com/a/13243870/4451315)


todo: use vulture API jendrikseipp/vulture#269 (comment)

@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Jan 3, 2022
@twoertwein
Copy link
Member

The return in pandas/tests/io/test_common.py was added in #39777 - @twoertwein are the two lines which come after it meant to be skipped?

I don't know why I added a return there :) Based on looking at the test case, I would assume that the return should be removed.

@MarcoGorelli
Copy link
Member Author

MarcoGorelli commented Jan 3, 2022

If I remove it I get


pandas/tests/io/test_common.py Fatal Python error: Segmentation fault

Current thread 0x00007f2448a8e740 (most recent call first):
  File "/home/marco/pandas-marco/pandas/io/parsers/c_parser_wrapper.py", line 83 in __init__
  File "/home/marco/pandas-marco/pandas/io/parsers/readers.py", line 1181 in _make_engine
  File "/home/marco/pandas-marco/pandas/io/parsers/readers.py", line 913 in __init__
  File "/home/marco/pandas-marco/pandas/io/parsers/readers.py", line 558 in _read
  File "/home/marco/pandas-marco/pandas/io/parsers/readers.py", line 663 in read_csv
  File "/home/marco/pandas-marco/pandas/util/_decorators.py", line 311 in wrapper
  File "/home/marco/pandas-marco/pandas/tests/io/test_common.py", line 577 in test_encoding_errors
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/python.py", line 183 in pytest_pyfunc_call
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/python.py", line 1641 in runtest
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 162 in pytest_runtest_call
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 255 in <lambda>
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 311 in from_call
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 254 in call_runtest_hook
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 215 in call_and_report
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 126 in runtestprotocol
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/runner.py", line 109 in pytest_runtest_protocol
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/main.py", line 348 in pytest_runtestloop
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/main.py", line 323 in _main
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/main.py", line 269 in wrap_session
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/main.py", line 316 in pytest_cmdline_main
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/callers.py", line 187 in _multicall
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 84 in <lambda>
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/manager.py", line 93 in _hookexec
  File "/home/marco/.local/lib/python3.8/site-packages/pluggy/hooks.py", line 286 in __call__
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/config/__init__.py", line 162 in main
  File "/home/marco/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/_pytest/config/__init__.py", line 185 in console_main
  File "/home/marco/miniconda3/envs/pandas-dev/bin/pytest", line 11 in <module>
Segmentation fault (core dumped)

So perhaps this return is making the test always pass and is masking an issue?

@twoertwein
Copy link
Member

twoertwein commented Jan 3, 2022

So perhaps this return is making the test always pass and is masking an issue?

Seems so, will look into it.

pytest -k test_encoding_errors[csv-None] pandas/tests/io/test_common.py: segfault
pytest -k test_encoding_errors[csv-replace] pandas/tests/io/test_common.py: fails
pytest -k test_encoding_errors[csv-strict] pandas/tests/io/test_common.py: passes

@twoertwein
Copy link
Member

@MarcoGorelli Thank you for catching my mistake! This is now fixed on master.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 4, 2022 17:47
@jreback jreback added this to the 1.5 milestone Jan 5, 2022
@jreback jreback merged commit e06d4a4 into pandas-dev:master Jan 5, 2022
@MarcoGorelli MarcoGorelli deleted the vulture branch January 6, 2022 09:00
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants