From c491a361718d03b7eff3d3a69b48292354dcac54 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Tue, 4 Apr 2023 22:43:54 +0100 Subject: avoid using capfd to test cli --- tests/test_cli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/test_cli.py') diff --git a/tests/test_cli.py b/tests/test_cli.py index 6f3beb2..5e0acb3 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -1,12 +1,14 @@ +from io import StringIO + from paste.__main__ import main -def test_cli(monkeypatch, capfd): +def test_cli(monkeypatch): monkeypatch.setattr("paste.__main__.db", None) monkeypatch.setattr("paste.__main__.application", None) monkeypatch.setattr("paste.__main__.store", None) monkeypatch.setenv("PASTE_DB", "test_value") - main(["paste", "--help"]) - _, err = capfd.readouterr() - assert "paste" in err + buf = StringIO() + main(["paste", "--help"], stderr=buf) + assert "paste" in buf.getvalue() -- cgit v1.2.3-54-g00ecf