Change in vdsm[master]: janitorial: drop remaining betterPopen references

danken at redhat.com danken at redhat.com
Mon Dec 9 12:51:08 UTC 2013


Dan Kenigsberg has uploaded a new change for review.

Change subject: janitorial: drop remaining betterPopen references
......................................................................

janitorial: drop remaining betterPopen references

betterPopen has been named cpopen long ago, and was spun off to an
independent package. This patch clears the remaining references to the
old vague name.

Change-Id: Idba693ef181f948e0ac4a525326698ef96684318
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M lib/vdsm/utils.py
M lib/zombiereaper/tests.py
M tests/Makefile.am
M tests/README
R tests/cPopenTests.py
M vdsm/storage/remoteFileHandler.py
6 files changed, 25 insertions(+), 27 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/22195/1

diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py
index d9c6cc5..d0f7b4f 100644
--- a/lib/vdsm/utils.py
+++ b/lib/vdsm/utils.py
@@ -53,7 +53,7 @@
 import time
 import zombiereaper
 
-from cpopen import CPopen as BetterPopen
+from cpopen import CPopen
 from . import constants
 
 # Buffsize is 1K because I tested it on some use cases and 1k was fastets. If
@@ -530,8 +530,8 @@
     cmdline = repr(subprocess.list2cmdline(printable))
     execCmdLogger.debug("%s (cwd %s)", cmdline, cwd)
 
-    p = BetterPopen(command, close_fds=True, cwd=cwd, env=env,
-                    deathSignal=deathSignal)
+    p = CPopen(command, close_fds=True, cwd=cwd, env=env,
+               deathSignal=deathSignal)
     p = AsyncProc(p)
     if not sync:
         if data is not None:
diff --git a/lib/zombiereaper/tests.py b/lib/zombiereaper/tests.py
index 3a85a11..425ac74 100644
--- a/lib/zombiereaper/tests.py
+++ b/lib/zombiereaper/tests.py
@@ -21,7 +21,7 @@
 import os
 
 import zombiereaper
-from cpopen import CPopen as BetterPopen
+from cpopen import CPopen
 
 from unittest import TestCase
 
@@ -30,7 +30,7 @@
 
 class zombieReaperTests(TestCase):
     def testProcessDiesAfterBeingTracked(self):
-        p = BetterPopen(["sleep", "1"])
+        p = CPopen(["sleep", "1"])
         zombiereaper.autoReapPID(p.pid)
         # wait for the grim reaper to arrive
         sleep(4)
@@ -39,7 +39,7 @@
         self.assertRaises(OSError, os.waitpid, p.pid, os.WNOHANG)
 
     def testProcessDiedBeforeBeingTracked(self):
-        p = BetterPopen(["sleep", "0"])
+        p = CPopen(["sleep", "0"])
         # wait for the process to die
         sleep(1)
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 435beca..2f9b1ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,7 +25,7 @@
 test_modules = \
 	alignmentScanTests.py \
 	apiTests.py \
-	betterPopenTests.py \
+	cPopenTests.py \
 	capsTests.py \
 	configNetworkTests.py \
 	fileVolumeTests.py \
diff --git a/tests/README b/tests/README
index e60389b..9e4d4b4 100644
--- a/tests/README
+++ b/tests/README
@@ -14,8 +14,8 @@
     ./run_tests.sh *.py
 
 Individual files or test cases can be specified:
-    ./run_tests.sh betterPopenTests.py
-    ./run_tests.sh betterPopenTests.py:TestBetterPopen.testEcho
+    ./run_tests.sh cPopenTests.py
+    ./run_tests.sh cPopenTests.py:TestCPopen.testEcho
 
 
 Functional test suite:
diff --git a/tests/betterPopenTests.py b/tests/cPopenTests.py
similarity index 88%
rename from tests/betterPopenTests.py
rename to tests/cPopenTests.py
index 7285877..a5c112b 100644
--- a/tests/betterPopenTests.py
+++ b/tests/cPopenTests.py
@@ -28,13 +28,13 @@
 
 if __name__ != "__main__":
     # This will not be available when we use this module as a subprocess
-    from cpopen import CPopen as BetterPopen
+    from cpopen import CPopen
 
 
-class TestBetterPopen(TestCaseBase):
+class TestCPopen(TestCaseBase):
     def testEcho(self):
         data = "Hello"
-        p = BetterPopen([EXT_ECHO, "-n", data])
+        p = CPopen([EXT_ECHO, "-n", data])
         p.wait()
         self.assertTrue(p.returncode == 0,
                         "Process failed: %s" % os.strerror(p.returncode))
@@ -42,7 +42,7 @@
 
     def testCat(self):
         path = "/etc/passwd"
-        p = BetterPopen(["cat", path])
+        p = CPopen(["cat", path])
         p.wait()
         self.assertTrue(p.returncode == 0,
                         "Process failed: %s" % os.strerror(p.returncode))
@@ -50,8 +50,7 @@
             self.assertEquals(p.stdout.read(), f.read())
 
     def _subTest(self, name, params, *args, **kwargs):
-        p = BetterPopen(["python", __file__, name] + params,
-                        *args, **kwargs)
+        p = CPopen(["python", __file__, name] + params, *args, **kwargs)
         p.wait()
         self.assertTrue(p.returncode == 0,
                         "Process failed: %s" % os.strerror(p.returncode))
@@ -80,25 +79,24 @@
 
     def testCwd(self):
         cwd = "/proc"
-        p = BetterPopen(["python", "-c", "import os; print os.getcwd()"],
-                        cwd=cwd)
+        p = CPopen(["python", "-c", "import os; print os.getcwd()"], cwd=cwd)
         p.wait()
         self.assertTrue(p.returncode == 0,
                         "Process failed: %s" % os.strerror(p.returncode))
         self.assertEquals(p.stdout.read().strip(), cwd)
 
     def testRunNonExecutable(self):
-        self.assertRaises(OSError, BetterPopen, ["/tmp"])
+        self.assertRaises(OSError, CPopen, ["/tmp"])
 
     def testBadCwd(self):
-        self.assertRaises(OSError, BetterPopen, ["echo", "hello"],
+        self.assertRaises(OSError, CPopen, ["echo", "hello"],
                           cwd="/~~~~~dasdas~~~~")
 
     def testUnicodeArg(self):
         data = u'hello'
         cmd = [EXT_ECHO, "-n", data]
 
-        p = BetterPopen(cmd)
+        p = CPopen(cmd)
         p.wait()
         p2 = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -114,7 +112,7 @@
 
         cmd = [EXT_ECHO, "-n", data]
 
-        p = BetterPopen(cmd)
+        p = CPopen(cmd)
         p.wait()
         p2 = subprocess.Popen(cmd, stdin=subprocess.PIPE,
                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -123,7 +121,7 @@
 
     def testStdin(self):
         data = "Hello World"
-        p = BetterPopen(["cat"])
+        p = CPopen(["cat"])
         p.stdin.write(data)
         p.stdin.flush()
         p.stdin.close()
@@ -137,7 +135,7 @@
         import select
 
         data = "Hello World"
-        p = BetterPopen(["cat"])
+        p = CPopen(["cat"])
         ep = select.epoll()
         ep.register(p.stdin, select.EPOLLOUT)
         fd, ev = ep.poll(1)[0]
diff --git a/vdsm/storage/remoteFileHandler.py b/vdsm/storage/remoteFileHandler.py
index 1461487..cacafbf 100644
--- a/vdsm/storage/remoteFileHandler.py
+++ b/vdsm/storage/remoteFileHandler.py
@@ -34,7 +34,7 @@
 if __name__ != "__main__":
     # The following modules are not used by the newly spawned child porcess.
     # Do not import them in the child to save memory.
-    from cpopen import CPopen as BetterPopen
+    from cpopen import CPopen
     from vdsm import constants
 else:
     # We add the parent directory so that imports that import the storage
@@ -230,9 +230,9 @@
                 env.get("PYTHONPATH", ""), constants.P_VDSM)
             env['PYTHONPATH'] = ":".join(map(os.path.abspath,
                                              env['PYTHONPATH'].split(":")))
-            self.process = BetterPopen([constants.EXT_PYTHON, __file__,
-                                       str(hisRead), str(hisWrite)],
-                                       close_fds=False, env=env)
+            self.process = CPopen([constants.EXT_PYTHON, __file__,
+                                  str(hisRead), str(hisWrite)],
+                                  close_fds=False, env=env)
 
             self.proxy = CrabRPCProxy(myRead, myWrite)
 


-- 
To view, visit http://gerrit.ovirt.org/22195
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idba693ef181f948e0ac4a525326698ef96684318
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>


More information about the vdsm-patches mailing list