Skip to content
Myr

Fix pager test leaks (#3238)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Rowlando13 · committed by GitHub · parents 63ea71f, b1bc8c9 · Browse files · 1 file+2 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−5 removed

  • tests:+2 added−5 removed

1 file+2 added−5 removed

modified:tests/test_utils.py+2 added-5 removed
7 unmodified lines
8from decimal import Decimal9from fractions import Fraction10from functools import partial11from io import StringIO12from pathlib import Path13from tempfile import tempdir12from unittest.mock import patch1314import pytest15
360 unmodified lines
376 expected_error=None,377 ),378 ],379)382def test_echo_via_pager(monkeypatch, capfd, pager_cmd, test):380def test_echo_via_pager(monkeypatch, capfd, pager_cmd, test, tmp_path):381 monkeypatch.setitem(os.environ, "PAGER", pager_cmd)382 monkeypatch.setattr(click._termui_impl, "isatty", lambda x: True)383384 test_input = test.test_input()
3 unmodified lines
388 expected_error = test.expected_error389390 check_raise = pytest.raises(expected_error) if expected_error else nullcontext()391394 pager_out_tmp = Path(tempdir) / "pager_out.txt"395 pager_out_tmp.unlink(missing_ok=True)392 pager_out_tmp = tmp_path / "pager_out.txt"393 with pager_out_tmp.open("w") as f:394 force_subprocess_stdout = patch.object(395 subprocess,396 "Popen",
349 unmodified lines