Change in vdsm[master]: vdsm-tool: prefix private methods with _
mtayer at redhat.com
mtayer at redhat.com
Sun May 18 15:59:21 UTC 2014
mooli tayer has uploaded a new change for review.
Change subject: vdsm-tool: prefix private methods with _
......................................................................
vdsm-tool: prefix private methods with _
Change-Id: I660c5492af2ed5e3ffb61b0a5308a43e03a0ce93
Signed-off-by: Mooli Tayer <mtayer at redhat.com>
---
M lib/vdsm/tool/configfile.py
M tests/toolTests.py
2 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/21/27821/1
diff --git a/lib/vdsm/tool/configfile.py b/lib/vdsm/tool/configfile.py
index a3870d4..1cc62b9 100644
--- a/lib/vdsm/tool/configfile.py
+++ b/lib/vdsm/tool/configfile.py
@@ -104,7 +104,7 @@
self.rmstate = BEFORE
return self
- def getOldContent(self):
+ def _getOldcontent(self):
confpat = re.compile(r'^\s*(?P<key>[^=\s#]*)\s*=')
oldlines = []
oldentries = set()
@@ -154,7 +154,7 @@
if exec_ty is None:
fd, tname = tempfile.mkstemp(dir=os.path.dirname(self.filename))
try:
- oldlines, oldentries = self.getOldContent()
+ oldlines, oldentries = self._getOldcontent()
with os.fdopen(fd, 'w', ) as f:
if self.section:
self._writeSection(f)
diff --git a/tests/toolTests.py b/tests/toolTests.py
index d9c6703..5774cce 100644
--- a/tests/toolTests.py
+++ b/tests/toolTests.py
@@ -186,12 +186,12 @@
os.remove(self.tname)
# helper function
- def writeConf(self, text):
+ def _writeConf(self, text):
with open(self.tname, 'w') as f:
f.write(text)
def testAddExistingConf(self):
- self.writeConf("key1=val1\n"
+ self._writeConf("key1=val1\n"
" key2 =val2\n"
"#key3=val4")
with ConfigFile(self.tname,
@@ -210,7 +210,7 @@
"# end conf-3.4.4\n")
def testPrefixAndPrepend(self):
- self.writeConf("/var/log/libvirt/libvirtd.log {\n"
+ self._writeConf("/var/log/libvirt/libvirtd.log {\n"
" weekly\n"
"}\n")
with ConfigFile(self.tname,
@@ -237,7 +237,7 @@
" weekly\n"
"}\n"
)
- self.writeConf(original)
+ self._writeConf(original)
with ConfigFile(self.tname,
version='3.4.4',
sectionStart="# start conf",
@@ -259,7 +259,7 @@
self.assertEqual(f.read(), original)
def testRemoveEntireLinePrefix(self):
- self.writeConf("# comment\n")
+ self._writeConf("# comment\n")
with ConfigFile(self.tname,
version='3.4.4',
sectionStart="# start conf",
@@ -270,7 +270,7 @@
self.assertEqual(f.read(), "\n")
def testRemoveConfSection(self):
- self.writeConf("key=val\n"
+ self._writeConf("key=val\n"
"key=val\n"
"# start conf-text-here don't matter\n"
"all you sections are belong to us\n"
@@ -296,7 +296,7 @@
self.assertRaises(RuntimeError, conff.removeConf)
def testHasConf(self):
- self.writeConf("key=val\n"
+ self._writeConf("key=val\n"
"kay=val\n"
"# start conf-3.4.4\n"
"all you sections are belong to us\n"
@@ -307,14 +307,14 @@
sectionEnd="# end conf").hasConf())
def testConfRead(self):
- self.writeConf("key=val\n"
+ self._writeConf("key=val\n"
"key1=val1\n")
conff = ParserWrapper(None)
conff.read(self.tname)
self.assertEqual(conff.get('key'), 'val')
def testConfDefaults(self):
- self.writeConf("key=val\n"
+ self._writeConf("key=val\n"
"key1=val1\n")
conff = ParserWrapper({'key2': 'val2'})
conff.read(self.tname)
--
To view, visit http://gerrit.ovirt.org/27821
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I660c5492af2ed5e3ffb61b0a5308a43e03a0ce93
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: mooli tayer <mtayer at redhat.com>
More information about the vdsm-patches
mailing list