|
7 | 7 | import io |
8 | 8 | import itertools |
9 | 9 | import opcode |
10 | | -import os |
11 | 10 | import re |
12 | 11 | import sys |
13 | 12 | import tempfile |
14 | 13 | import textwrap |
15 | 14 | import types |
16 | 15 | import unittest |
17 | | -from test.support import (captured_stdout, requires_debug_ranges, |
18 | | - requires_specialization, cpython_only, |
19 | | - os_helper, import_helper, reset_code) |
| 16 | +from test.support import (captured_stdout, force_not_colorized_test_class, |
| 17 | + requires_debug_ranges, requires_specialization, |
| 18 | + cpython_only, os_helper, import_helper, reset_code) |
20 | 19 | from test.support.bytecode_helper import BytecodeTestCase |
21 | 20 |
|
22 | 21 |
|
23 | | -os.environ.setdefault("NO_COLOR", "1") |
24 | | - |
25 | 22 | CACHE = dis.opmap["CACHE"] |
26 | 23 |
|
27 | 24 | def get_tb(): |
@@ -995,6 +992,7 @@ def do_disassembly_compare(self, got, expected): |
995 | 992 | self.assertEqual(got, expected) |
996 | 993 |
|
997 | 994 |
|
| 995 | +@force_not_colorized_test_class |
998 | 996 | class DisTests(DisTestBase): |
999 | 997 |
|
1000 | 998 | maxDiff = None |
@@ -1471,6 +1469,7 @@ def f(): |
1471 | 1469 | self.assertEqual(assem_op, assem_cache) |
1472 | 1470 |
|
1473 | 1471 |
|
| 1472 | +@force_not_colorized_test_class |
1474 | 1473 | class DisWithFileTests(DisTests): |
1475 | 1474 |
|
1476 | 1475 | # Run the tests again, using the file arg instead of print |
@@ -1993,6 +1992,7 @@ def assertInstructionsEqual(self, instrs_1, instrs_2, /): |
1993 | 1992 | instrs_2 = [instr_2._replace(positions=None, cache_info=None) for instr_2 in instrs_2] |
1994 | 1993 | self.assertEqual(instrs_1, instrs_2) |
1995 | 1994 |
|
| 1995 | +@force_not_colorized_test_class |
1996 | 1996 | class InstructionTests(InstructionTestCase): |
1997 | 1997 |
|
1998 | 1998 | def __init__(self, *args): |
@@ -2314,6 +2314,7 @@ def test_cache_offset_and_end_offset(self): |
2314 | 2314 |
|
2315 | 2315 | # get_instructions has its own tests above, so can rely on it to validate |
2316 | 2316 | # the object oriented API |
| 2317 | +@force_not_colorized_test_class |
2317 | 2318 | class BytecodeTests(InstructionTestCase, DisTestBase): |
2318 | 2319 |
|
2319 | 2320 | def test_instantiation(self): |
@@ -2445,6 +2446,7 @@ def func(): |
2445 | 2446 | self.assertEqual(offsets, [0, 2]) |
2446 | 2447 |
|
2447 | 2448 |
|
| 2449 | +@force_not_colorized_test_class |
2448 | 2450 | class TestDisTraceback(DisTestBase): |
2449 | 2451 | def setUp(self) -> None: |
2450 | 2452 | try: # We need to clean up existing tracebacks |
@@ -2482,6 +2484,7 @@ def test_distb_explicit_arg(self): |
2482 | 2484 | self.do_disassembly_compare(self.get_disassembly(tb), dis_traceback) |
2483 | 2485 |
|
2484 | 2486 |
|
| 2487 | +@force_not_colorized_test_class |
2485 | 2488 | class TestDisTracebackWithFile(TestDisTraceback): |
2486 | 2489 | # Run the `distb` tests again, using the file arg instead of print |
2487 | 2490 | def get_disassembly(self, tb): |
@@ -2516,6 +2519,7 @@ def _unroll_caches_as_Instructions(instrs, show_caches=False): |
2516 | 2519 | False, None, None, instr.positions) |
2517 | 2520 |
|
2518 | 2521 |
|
| 2522 | +@force_not_colorized_test_class |
2519 | 2523 | class TestDisCLI(unittest.TestCase): |
2520 | 2524 |
|
2521 | 2525 | def setUp(self): |
|
0 commit comments