[Buildbot-commits] buildbot/buildbot/test test_properties.py, 1.19, 1.20
Brian Warner
warner at users.sourceforge.net
Mon May 26 23:52:25 UTC 2008
Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv22229/buildbot/test
Modified Files:
test_properties.py
Log Message:
[project @ #234:shell-style-substitutions.patch]
Add support for shell-style substitutions, e.g.,
%(propname:-replacement)s and %(propname:+replacement)s
Original author: dustin at v.igoro.us
Date: 2008-04-15 04:31:40+00:00
Index: test_properties.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_properties.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- test_properties.py 26 May 2008 23:52:13 -0000 1.19
+++ test_properties.py 26 May 2008 23:52:23 -0000 1.20
@@ -47,12 +47,6 @@
self.assertRaises(KeyError, lambda : self.props['do-nothing'])
self.failUnlessEqual(self.props.getProperty('do-install'), 2)
- def testEmpty(self):
- # test the special case for Null
- self.props.setProperty("x", None, "hi")
- self.failUnlessEqual(self.props.getProperty('x'), None)
- self.failUnlessEqual(self.props['x'], '')
-
def testUpdate(self):
self.props.setProperty("x", 24, "old")
newprops = { 'a' : 1, 'b' : 2 }
@@ -95,6 +89,20 @@
self.failUnlessEqual(self.props.render(command),
"build-foo.tar.gz")
+ def testDictColonMinus(self):
+ # test dict-style substitution with WithProperties
+ self.props.setProperty("prop1", "foo", "test")
+ command = WithProperties("build-%(prop1:-empty)s-%(prop2:-empty)s.tar.gz")
+ self.failUnlessEqual(self.props.render(command),
+ "build-foo-empty.tar.gz")
+
+ def testDictColonPlus(self):
+ # test dict-style substitution with WithProperties
+ self.props.setProperty("prop1", "foo", "test")
+ command = WithProperties("build-%(prop1:+exists)s-%(prop2:+exists)s.tar.gz")
+ self.failUnlessEqual(self.props.render(command),
+ "build-exists-.tar.gz")
+
def testEmpty(self):
# None should render as ''
self.props.setProperty("empty", None, "test")
More information about the Commits
mailing list