summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unittest/test_program.py
diff options
context:
space:
mode:
authorHugo van Kemenade <1324225+hugovk@users.noreply.github.com>2024-12-05 19:10:46 (GMT)
committerGitHub <noreply@github.com>2024-12-05 19:10:46 (GMT)
commit23f2e8f13c4e4a34106cf96fad9329cbfbf8844d (patch)
treea2f306c0ccd6c05302f4bb5eb279e3f0f6834a65 /Lib/test/test_unittest/test_program.py
parentd958d9f4a1b71c6d30960bf6c53c41046ea94590 (diff)
downloadcpython-23f2e8f13c4e4a34106cf96fad9329cbfbf8844d.zip
cpython-23f2e8f13c4e4a34106cf96fad9329cbfbf8844d.tar.gz
cpython-23f2e8f13c4e4a34106cf96fad9329cbfbf8844d.tar.bz2
gh-127221: Add colour to unittest output (#127223)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
Diffstat (limited to 'Lib/test/test_unittest/test_program.py')
-rw-r--r--Lib/test/test_unittest/test_program.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_unittest/test_program.py b/Lib/test/test_unittest/test_program.py
index 7241cf5..0b46f33 100644
--- a/Lib/test/test_unittest/test_program.py
+++ b/Lib/test/test_unittest/test_program.py
@@ -4,6 +4,7 @@ import subprocess
from test import support
import unittest
import test.test_unittest
+from test.support import force_not_colorized
from test.test_unittest.test_result import BufferedWriter
@@ -120,6 +121,7 @@ class Test_TestProgram(unittest.TestCase):
self.assertEqual(['test.test_unittest', 'test.test_unittest2'],
program.testNames)
+ @force_not_colorized
def test_NonExit(self):
stream = BufferedWriter()
program = unittest.main(exit=False,
@@ -135,6 +137,7 @@ class Test_TestProgram(unittest.TestCase):
'expected failures=1, unexpected successes=1)\n')
self.assertTrue(out.endswith(expected))
+ @force_not_colorized
def test_Exit(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm:
@@ -152,6 +155,7 @@ class Test_TestProgram(unittest.TestCase):
'expected failures=1, unexpected successes=1)\n')
self.assertTrue(out.endswith(expected))
+ @force_not_colorized
def test_ExitAsDefault(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit):
@@ -167,6 +171,7 @@ class Test_TestProgram(unittest.TestCase):
'expected failures=1, unexpected successes=1)\n')
self.assertTrue(out.endswith(expected))
+ @force_not_colorized
def test_ExitSkippedSuite(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm:
@@ -179,6 +184,7 @@ class Test_TestProgram(unittest.TestCase):
expected = '\n\nOK (skipped=1)\n'
self.assertTrue(out.endswith(expected))
+ @force_not_colorized
def test_ExitEmptySuite(self):
stream = BufferedWriter()
with self.assertRaises(SystemExit) as cm: