8000 REF/TST: replace capture_stderr with pytest capsys fixture by simonjayhawkins · Pull Request #24496 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

REF/TST: replace capture_stderr with pytest capsys fixture #24496

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 9 commits into from
Dec 30, 2018
Prev Previous commit
Next Next commit
use capsys in test_warn_bad_lines
  • Loading branch information
simonjayhawkins committed Dec 30, 2018
commit aef1ffb24b40d3c99453e8712186946e629e09f4
9 changes: 4 additions & 5 deletions pandas/tests/io/parser/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1867,8 +1867,7 @@ def test_error_bad_lines(all_parsers, kwargs, warn_kwargs):
parser.read_csv(StringIO(data), **kwargs)


@tm.capture_stderr
def test_warn_bad_lines(all_parsers):
def test_warn_bad_lines(all_parsers, capsys):
# see gh-15925
parser = all_parsers
data = "a\n1\n1,2,3\n4\n5,6,7"
Expand All @@ -1879,9 +1878,9 @@ def test_warn_bad_lines(all_parsers):
warn_bad_lines=True)
tm.assert_frame_equal(result, expected)

val = sys.stderr.getvalue()
assert "Skipping line 3" in val
assert "Skipping line 5" in val
captured = capsys.readouterr()
assert "Skipping line 3" in captured.err
assert "Skipping line 5" in captured.err


@tm.capture_stderr
Expand Down
0