]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: make test_ceph_argparse.py pass on py3-only systems 22988/head
authorNathan Cutler <ncutler@suse.com>
Fri, 6 Jul 2018 22:47:34 +0000 (00:47 +0200)
committerPrashant D <pdhange@redhat.com>
Wed, 11 Jul 2018 05:15:36 +0000 (01:15 -0400)
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 d1769f714891adfd4160a24210295b5513dce20c..55e04c231d7b4dbb4f3e4a199c2dfd0568dea008 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']