Dan Kenigsberg has uploaded a new change for review.

Change subject: commands: import StringIO only on Python 2
......................................................................

commands: import StringIO only on Python 2

This patch makes it possible to import vdsm.commands on Python 3.
However, it does not make the module py3-compatible - any usage of
AsyncProc under Python 3 would fail in runtime.

The motivation of this patch is to allow adding more modules to the
test_modules_py3 list, while causing no runtime harm to Python 3.

Change-Id: I3610865945aeee3b13b8e195c749023a524ebe97
Signed-off-by: Dan Kenigsberg <dan...@redhat.com>
---
M lib/vdsm/commands.py
M tests/Makefile.am
2 files changed, 23 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/80/55380/1

diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py
index 5e86262..66b563a 100644
--- a/lib/vdsm/commands.py
+++ b/lib/vdsm/commands.py
@@ -19,8 +19,6 @@
 #
 from __future__ import absolute_import
 
-from StringIO import StringIO
-
 from weakref import proxy
 import errno
 import io
@@ -28,6 +26,7 @@
 import os
 import select
 import signal
+import sys
 import threading
 import time
 from . import cmdutils
@@ -36,6 +35,11 @@
 from .utils import NoIntrPoll, stripNewLines
 from vdsm import constants
 
+# this is an ugly hack to let this module load on Python 3, and fail later when
+# AsyncProc is used.
+if sys.version_info[0] == 2:
+    from StringIO import StringIO
+
 # Buffsize is 1K because I tested it on some use cases and 1K was fastest. If
 # you find this number to be a bottleneck in any way you are welcome to change
 # it
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3feb093..9d914e6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,18 +31,33 @@
 
 test_modules_py3 = \
        apiData.py \
-       virt_api_test.py \
        cmdutilsTests.py \
+       concurrentTests.py \
+       cpuinfo_test.py \
        cpuProfileTests.py \
-       sslTests.py \
        domainDescriptorTests.py \
+       exception_test.py \
        executorTests.py \
+       gluster_exception_test.py \
+       glusterTestData.py \
+       hookValidation.py \
+       jobsTests.py \
+       libvirtconnectionTests.py \
+       modprobe.py \
+       monkeypatch.py \
+       network/ipwrapper_test.py \
        passwordsTests.py \
        permutationTests.py \
        pthreadTests.py \
        responseTests.py \
        scheduleTests.py \
+       sslTests.py \
+       testlib.py \
+       testrunner.py \
+       testValidation.py \
+       virt_api_test.py \
        vmStatsTests.py \
+       vmTestsData.py \
        $(NULL)
 
 common_modules = common/*_test.py


-- 
To view, visit https://gerrit.ovirt.org/55380
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3610865945aeee3b13b8e195c749023a524ebe97
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <dan...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to