Commit ade1e3864f1508ad0ccbce72a39d815c2d7d7c87
1 parent
e6d85ff9f2
Exists in
smarc_8mq_lf_v2020.04
and in
9 other branches
patman: Support use of stringIO in Python 3
With Python 3 this class has moved. Update the code to handle both cases. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
tools/patman/func_test.py
... | ... | @@ -12,15 +12,20 @@ |
12 | 12 | import tempfile |
13 | 13 | import unittest |
14 | 14 | |
15 | +try: | |
16 | + from StringIO import StringIO | |
17 | +except ImportError: | |
18 | + from io import StringIO | |
19 | + | |
15 | 20 | import gitutil |
16 | 21 | import patchstream |
17 | 22 | import settings |
23 | +import tools | |
18 | 24 | |
19 | 25 | |
20 | 26 | @contextlib.contextmanager |
21 | 27 | def capture(): |
22 | 28 | import sys |
23 | - from cStringIO import StringIO | |
24 | 29 | oldout,olderr = sys.stdout, sys.stderr |
25 | 30 | try: |
26 | 31 | out=[StringIO(), StringIO()] |