]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: make test_ceph_argparse.py pass on py3-only systems 23113/head
authorNathan Cutler <ncutler@suse.com>
Fri, 6 Jul 2018 22:47:34 +0000 (00:47 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 18 Jul 2018 11:51:58 +0000 (13:51 +0200)
On systems that do not have Python 2 installed, this test fails to
import StringIO.

Fixes: http://tracker.ceph.com/issues/24816
Signed-off-by: Nathan Cutler <ncutler@suse.com>
(cherry picked from commit 5ed075d77f2be7aba6ae011b67a7cf9e3cd7d321)

src/test/pybind/test_ceph_argparse.py

index b0f7f74b2c7a2fdebdbab2663a274218caecac13..cef0a2fc404ebf5c5a69130e8042c199f3f90ade 100755 (executable)
@@ -24,7 +24,10 @@ import os
 import re
 import sys
 import json
-from StringIO import StringIO
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 
 def get_command_descriptions(what):
     CEPH_BIN = os.environ['CEPH_BIN']