STYLE add vulture hook
State: closed

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 https://github.com/jendrikseipp/vulture/issues/269#issuecomment-1004416890

Labels:
name: Code Style
description: Code style, linting, code_checks

Comments:
> 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.
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?
> 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
@MarcoGorelli Thank you for catching my mistake! This is now fixed on master.