From dc36a46778f5e37a4855bc9d202b397ba63f99a7 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 30 Apr 2023 07:36:15 -0400 Subject: test: slim down the fake stdout test --- tests/test_misc.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tests/test_misc.py b/tests/test_misc.py index d489f171..4b83f8ae 100644 --- a/tests/test_misc.py +++ b/tests/test_misc.py @@ -6,7 +6,6 @@ from __future__ import annotations import sys -from typing import Any from unittest import mock import pytest @@ -170,15 +169,6 @@ def test_stdout_link_not_tty() -> None: def test_stdout_link_with_fake_stdout() -> None: # If stdout is another object, we should still be ok. - class FakeStdout: - """New stdout, has .write(), but not .isatty().""" - def __init__(self, f: Any) -> None: - self.f = f - - def write(self, data: str) -> Any: - """Write through to the underlying file.""" - return self.f.write(data) - - with mock.patch.object(sys, "stdout", FakeStdout(sys.stdout)): + with mock.patch.object(sys, "stdout", object()): link = stdout_link("some text", "some url") assert link == "some text" -- cgit v1.2.1