5
5
import unittest
6
6
from test .support import (
7
7
captured_stdout ,
8
- force_not_colorized ,
9
8
force_not_colorized_test_class ,
10
9
warnings_helper ,
11
10
)
@@ -37,6 +36,7 @@ def bad_cleanup2():
37
36
raise ValueError ('bad cleanup2' )
38
37
39
38
39
+ @force_not_colorized_test_class
40
40
class Test_TestResult (unittest .TestCase ):
41
41
# Note: there are not separate tests for TestResult.wasSuccessful(),
42
42
# TestResult.errors, TestResult.failures, TestResult.testsRun or
@@ -208,7 +208,6 @@ def test_1(self):
208
208
self .assertIs (test_case , test )
209
209
self .assertIsInstance (formatted_exc , str )
210
210
211
- @force_not_colorized
212
211
def test_addFailure_filter_traceback_frames (self ):
213
212
class Foo (unittest .TestCase ):
214
213
def test_1 (self ):
@@ -235,7 +234,6 @@ def get_exc_info():
235
234
self .assertEqual (len (dropped ), 1 )
236
235
self .assertIn ("raise self.failureException(msg)" , dropped [0 ])
237
236
238
- @force_not_colorized
239
237
def test_addFailure_filter_traceback_frames_context (self ):
240
238
class Foo (unittest .TestCase ):
241
239
def test_1 (self ):
@@ -265,7 +263,6 @@ def get_exc_info():
265
263
self .assertEqual (len (dropped ), 1 )
266
264
self .assertIn ("raise self.failureException(msg)" , dropped [0 ])
267
265
268
- @force_not_colorized
269
266
def test_addFailure_filter_traceback_frames_chained_exception_self_loop (self ):
270
267
class Foo (unittest .TestCase ):
271
268
def test_1 (self ):
@@ -291,7 +288,6 @@ def get_exc_info():
291
288
formatted_exc = result .failures [0 ][1 ]
292
289
self .assertEqual (formatted_exc .count ("Exception: Loop\n " ), 1 )
293
290
294
- @force_not_colorized
295
291
def test_addFailure_filter_traceback_frames_chained_exception_cycle (self ):
296
292
class Foo (unittest .TestCase ):
297
293
def test_1 (self ):
@@ -453,7 +449,6 @@ def testFailFast(self):
453
449
result .addUnexpectedSuccess (None )
454
450
self .assertTrue (result .shouldStop )
455
451
456
- @force_not_colorized
457
452
def testFailFastSetByRunner (self ):
458
453
stream = BufferedWriter ()
459
454
runner = unittest .TextTestRunner (stream = stream , failfast = True )
@@ -465,6 +460,7 @@ def test(result):
465
460
self .assertTrue (stream .getvalue ().endswith ('\n \n OK\n ' ))
466
461
467
462
463
+ @force_not_colorized_test_class
468
464
class Test_TextTestResult (unittest .TestCase ):
469
465
maxDiff = None
470
466
@@ -627,7 +623,6 @@ def _run_test(self, test_name, verbosity, tearDownError=None):
627
623
test .run (result )
628
624
return stream .getvalue ()
629
625
630
- @force_not_colorized
631
626
def testDotsOutput (self ):
632
627
self .assertEqual (self ._run_test ('testSuccess' , 1 ), '.' )
633
628
self .assertEqual (self ._run_test ('testSkip' , 1 ), 's' )
@@ -636,7 +631,6 @@ def testDotsOutput(self):
636
631
self .assertEqual (self ._run_test ('testExpectedFailure' , 1 ), 'x' )
637
632
self .assertEqual (self ._run_test ('testUnexpectedSuccess' , 1 ), 'u' )
638
633
639
- @force_not_colorized
640
634
def testLongOutput (self ):
641
635
classname = f'{ __name__ } .{ self .Test .__qualname__ } '
642
636
self .assertEqual (self ._run_test ('testSuccess' , 2 ),
@@ -652,21 +646,17 @@ def testLongOutput(self):
652
646
self .assertEqual (self ._run_test ('testUnexpectedSuccess' , 2 ),
653
647
f'testUnexpectedSuccess ({ classname } .testUnexpectedSuccess) ... unexpected success\n ' )
654
648
655
- @force_not_colorized
656
649
def testDotsOutputSubTestSuccess (self ):
657
650
self .assertEqual (self ._run_test ('testSubTestSuccess' , 1 ), '.' )
658
651
659
- @force_not_colorized
660
652
def testLongOutputSubTestSuccess (self ):
661
653
classname = f'{ __name__ } .{ self .Test .__qualname__ } '
662
654
self .assertEqual (self ._run_test ('testSubTestSuccess' , 2 ),
663
655
f'testSubTestSuccess ({ classname } .testSubTestSuccess) ... ok\n ' )
664
656
665
- @force_not_colorized
666
657
def testDotsOutputSubTestMixed (self ):
667
658
self .assertEqual (self ._run_test ('testSubTestMixed' , 1 ), 'sFE' )
668
659
669
- @force_not_colorized
670
660
def testLongOutputSubTestMixed (self ):
671
661
classname = f'{ __name__ } .{ self .Test .__qualname__ } '
672
662
self .assertEqual (self ._run_test ('testSubTestMixed' , 2 ),
@@ -675,7 +665,6 @@ def testLongOutputSubTestMixed(self):
675
665
f' testSubTestMixed ({ classname } .testSubTestMixed) [fail] (c=3) ... FAIL\n '
676
666
f' testSubTestMixed ({ classname } .testSubTestMixed) [error] (d=4) ... ERROR\n ' )
677
667
678
- @force_not_colorized
679
668
def testDotsOutputTearDownFail (self ):
680
669
out = self ._run_test ('testSuccess' , 1 , AssertionError ('fail' ))
681
670
self .assertEqual (out , 'F' )
@@ -686,7 +675,6 @@ def testDotsOutputTearDownFail(self):
686
675
out = self ._run_test ('testSkip' , 1 , AssertionError ('fail' ))
687
676
self .assertEqual (out , 'sF' )
688
677
689
- @force_not_colorized
690
678
def testLongOutputTearDownFail (self ):
691
679
classname = f'{ __name__ } .{ self .Test .__qualname__ } '
692
680
out = self ._run_test ('testSuccess' , 2 , AssertionError ('fail' ))
0 commit comments