mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-24 15:11:19 +02:00
loman: don't report error when adding an exact duplicate.
BUG=5787 TEST=Updated and re-ran unittests. Change-Id: I399e8cacde103f16b749dd83c57d03bcdf2e9475 Review URL: http://codereview.chromium.org/3385001
This commit is contained in:
parent
03b6ebf7d4
commit
6c6000b2c2
@ -43,6 +43,9 @@ class LocalManifest:
|
||||
|
||||
for project in self._root.findall('project'):
|
||||
if project.attrib['path'] == path or project.attrib['name'] == name:
|
||||
if project.attrib['path'] == path and project.attrib['name'] == name:
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
self._AddProject(name, path, workon='True')
|
||||
return True
|
||||
|
@ -52,7 +52,7 @@ class LocalManifestTest(unittest.TestCase):
|
||||
ptree = loman.LocalManifest('<manifest>\n</manifest>')
|
||||
ptree.Parse()
|
||||
ptree.AddWorkonProject('foo', 'path/to/foo')
|
||||
self.assertTrue(not ptree.AddWorkonProject('foo', 'path/to/foo'))
|
||||
self.assertTrue(ptree.AddWorkonProject('foo', 'path/to/foo'))
|
||||
self.assertTrue(not ptree.AddWorkonProject('foo', 'path/foo'))
|
||||
self.assertTrue(not ptree.AddWorkonProject('foobar', 'path/to/foo'))
|
||||
|
||||
@ -100,11 +100,13 @@ class MainTest(unittest.TestCase):
|
||||
print >> temp, '<manifest>\n</manifest>'
|
||||
temp.flush()
|
||||
os.fsync(temp.fileno())
|
||||
loman.main(['loman', 'add', '--workon', '-f',
|
||||
temp.name, 'foo', 'path/to/foo'])
|
||||
loman.main(['loman', 'add', '--workon', '-f',
|
||||
temp.name, 'foo', 'path/to/foo'])
|
||||
self.assertRaises(SystemExit, loman.main,
|
||||
['loman', 'add', '--workon', '-f',
|
||||
temp.name, 'foo', 'path/to/foo'])
|
||||
temp.name, 'foo', 'path/foo'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user