|
1 | 1 | # Minimal tests for dis module
|
2 |
| -# |
3 |
| -# Do NOT change the order of the imports since it could lead to a timeout for |
4 |
| -# test_embed.test_specialized_static_code_gets_unspecialized_at_Py_FINALIZE |
5 |
| -# on Windows 32-bits. |
6 | 2 |
|
7 | 3 | import contextlib
|
8 | 4 | import dis
|
9 | 5 | import io
|
| 6 | +import opcode |
10 | 7 | import re
|
11 | 8 | import sys
|
| 9 | +import tempfile |
12 | 10 | import types
|
13 | 11 | import unittest
|
14 | 12 | from test.support import (captured_stdout, requires_debug_ranges,
|
15 |
| - requires_specialization, cpython_only) |
| 13 | + requires_specialization, cpython_only, |
| 14 | + os_helper) |
16 | 15 | from test.support.bytecode_helper import BytecodeTestCase
|
17 | 16 |
|
18 |
| -import opcode |
19 |
| - |
20 | 17 |
|
21 | 18 | def get_tb():
|
22 | 19 | def _error():
|
@@ -2074,17 +2071,16 @@ def get_disassembly(self, tb):
|
2074 | 2071 |
|
2075 | 2072 |
|
2076 | 2073 | class TestDisCLI(unittest.TestCase):
|
2077 |
| - pass |
2078 | 2074 |
|
2079 |
| - # def setUp(self): |
2080 |
| - # self.filename = tempfile.mktemp() |
2081 |
| - # self.addCleanup(os_helper.unlink, self.filename) |
| 2075 | + def setUp(self): |
| 2076 | + self.filename = tempfile.mktemp() |
| 2077 | + self.addCleanup(os_helper.unlink, self.filename) |
2082 | 2078 |
|
2083 |
| - # def test_invocation(self): |
2084 |
| - # with self.assertRaises(SystemExit): |
2085 |
| - # # suppress argparse error message |
2086 |
| - # with contextlib.redirect_stderr(io.StringIO()): |
2087 |
| - # dis.main(args=['--unknown', self.filename]) |
| 2079 | + def test_invocation(self): |
| 2080 | + with self.assertRaises(SystemExit): |
| 2081 | + # suppress argparse error message |
| 2082 | + with contextlib.redirect_stderr(io.StringIO()): |
| 2083 | + dis.main(args=['--unknown', self.filename]) |
2088 | 2084 |
|
2089 | 2085 |
|
2090 | 2086 | if __name__ == "__main__":
|
|
0 commit comments