[SCM] build.samba.org - branch master updated
Jelmer Vernooij
jelmer at samba.org
Mon Nov 22 15:20:06 MST 2010
The branch, master has been updated
via d66fb97 revive FileLoad for the moment - it's used by the web interface.
from 10801ce Fix revision_from_logs.
http://gitweb.samba.org/?p=build-farm.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit d66fb9758d61f6f08c50e857def0f869ef0afdce
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Mon Nov 22 23:19:10 2010 +0100
revive FileLoad for the moment - it's used by the web interface.
-----------------------------------------------------------------------
Summary of changes:
buildfarm/tests/test_util.py | 25 ++++++++++++++++++++++++-
buildfarm/util.py | 9 +++++++++
2 files changed, 33 insertions(+), 1 deletions(-)
Changeset truncated at 500 lines:
diff --git a/buildfarm/tests/test_util.py b/buildfarm/tests/test_util.py
index 17bb161..a727ee2 100755
--- a/buildfarm/tests/test_util.py
+++ b/buildfarm/tests/test_util.py
@@ -15,11 +15,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+import os
+import tempfile
import testtools
+import unittest
from buildfarm import util
-class DhmTimeTests(testtools.TestCase):
+class DhmTimeTests(unittest.TestCase):
def test_simple(self):
self.assertEquals("0s", util.dhm_time(0))
@@ -27,3 +30,23 @@ class DhmTimeTests(testtools.TestCase):
self.assertEquals("-", util.dhm_time(-20))
self.assertEquals("1d 3h 1m", util.dhm_time(97265))
self.assertEquals("3h 1m", util.dhm_time(10865))
+
+
+class LoadTests(testtools.TestCase):
+
+ def test_simple(self):
+ fd, name = tempfile.mkstemp()
+ self.addCleanup(os.remove, name)
+ f = os.fdopen(fd, 'w')
+ f.write("""one
+two
+three
+
+for
+""")
+ f.close()
+ l = util.load_list(name)
+ self.assertEquals(4, len(l))
+ self.assertEquals("three", l[2])
+
+
diff --git a/buildfarm/util.py b/buildfarm/util.py
index 70989a1..9d6c8ca 100644
--- a/buildfarm/util.py
+++ b/buildfarm/util.py
@@ -32,6 +32,15 @@ def load_list(fname):
return ret
+def FileLoad(filename):
+ """read a file into a string"""
+ f = open(filename, 'r')
+ try:
+ return f.read()
+ finally:
+ f.close()
+
+
def dhm_time(sec):
"""display a time as days, hours, minutes"""
days = int(sec / (60*60*24));
--
build.samba.org
More information about the samba-cvs
mailing list