From: Free Ekanayaka Date: Sat, 26 Nov 2016 11:37:52 +0000 Subject: Tests: Fix ckeygen test writing to stderr Improve test process which writes on stderr which will fail within the Debian autopkgtest environment otherwise. Forwarded: https://twistedmatrix.com/trac/ticket/8924 --- src/twisted/conch/test/test_ckeygen.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/twisted/conch/test/test_ckeygen.py b/src/twisted/conch/test/test_ckeygen.py index ea2be91..581b9ff 100644 --- a/src/twisted/conch/test/test_ckeygen.py +++ b/src/twisted/conch/test/test_ckeygen.py @@ -10,6 +10,7 @@ import getpass import os import subprocess import sys +import os from io import StringIO from typing import Callable, NoReturn @@ -114,7 +115,10 @@ class KeyGenTests(TestCase): def test_runBadKeytype(self) -> None: filename = self.mktemp() with self.assertRaises(subprocess.CalledProcessError): - subprocess.check_call(["ckeygen", "-t", "foo", "-f", filename]) + with open(os.devnull, "rb") as devnull: + subprocess.check_call( + ['ckeygen', '-t', 'foo', '-f', filename], + stderr=devnull) def test_enumrepresentation(self) -> None: """