]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tests: make test_ceph_argparse.py pass on py3-only systems
authorNathan Cutler <ncutler@suse.com>
Fri, 6 Jul 2018 22:47:34 +0000 (00:47 +0200)
committerNathan Cutler <ncutler@suse.com>
Fri, 6 Jul 2018 22:47:34 +0000 (00:47 +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>
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']