本文整理汇总了Python中osc2.wc.project.Project类的典型用法代码示例。如果您正苦于以下问题:Python Project类的具体用法?Python Project怎么用?Python Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_repair3
def test_repair3(self):
"""test repair (invalid _packages xml)"""
path = self.fixture_file('inv4')
self.assertRaises(WCInconsistentError, Project, path)
self.assertRaises(ValueError, Project.repair, path)
Project.repair(path, added='A', missing=' ')
self.assertEqual(Project.wc_check(path), ([], '', []))
示例2: test_commit5
def test_commit5(self):
"""test commit (finish pending transaction (delete))"""
path = self.fixture_file('prj2_commit_resume')
prj = Project(path, finish_pending_transaction=False)
self.assertEqual(prj._status('abc'), 'D')
prj.commit('abc')
self.assertEqual(prj._status('abc'), '?')
示例3: test3
def test3(self):
"""read project"""
path = self.fixture_file('prj1')
prj = Project(path)
self.assertEqual(prj.name, 'prj1')
self.assertEqual(prj.apiurl, 'http://apiurl')
self.assertTrue(len(prj.packages()) == 2)
示例4: test_update1
def test_update1(self):
"""test update"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
prj.update('foo', foo='bar')
self.assertEqual(prj._status('foo'), ' ')
self._not_exists(path, '.osc', '_transaction')
示例5: test_update3
def test_update3(self):
"""test update (delete package; local state '!')"""
path = self.fixture_file('prj2')
self._not_exists(path, 'xxx')
prj = Project(path)
prj.update('xxx')
self.assertEqual(prj._status('xxx'), '?')
self._not_exists(path, '.osc', 'data', 'xxx')
示例6: _checkout
def _checkout(info):
path = os.path.join(os.getcwd(), info.project)
if not os.path.exists(path):
Project.init(path, info.project, info.apiurl)
packages = []
if hasattr(info, 'package'):
packages.append(info.package)
prj = Project(path, transaction_listener=[MyTransactionListener()])
prj.update(*packages)
示例7: test_update7
def test_update7(self):
"""test update (finish pending add transaction auto)"""
path = self.fixture_file('prj1_update_resume')
self._not_exists(path, 'foo')
prj = Project(path, finish_pending_transaction=True)
self.assertEqual(prj._status('foo'), ' ')
self._exists(path, 'foo')
self._exists(path, 'foo', 'file')
self._exists(path, '.osc', 'data', 'foo')
示例8: test18
def test18(self):
"""test remove (also check if the files were removed)"""
path = self.fixture_file('prj2')
prj = Project(path)
self.assertEqual(prj._status('bar'), 'A')
prj.remove('bar')
self.assertEqual(prj._status('bar'), '?')
self._not_exists(path, 'bar')
self._not_exists(path, 'bar', data=True)
示例9: _status
def _status(info):
path = os.getcwd()
if hasattr(info, 'package'):
pkg = Package(path)
for filename in sorted(os.listdir(path)):
print "%s\t%s" % (pkg.status(filename), filename)
else:
prj = Project(path)
for package in sorted(os.listdir(path)):
print "%s\t%s" % (prj._status(package), package)
示例10: test7
def test7(self):
"""test _calculate_updateinfo"""
path = self.fixture_file('prj2')
prj = Project(path)
uinfo = prj._calculate_updateinfo()
self.assertEqual(uinfo.candidates, ['foo', 'abc'])
self.assertEqual(uinfo.added, ['osc'])
self.assertEqual(uinfo.deleted, ['del', 'foo_modified'])
self.assertEqual(uinfo.conflicted, ['xxx'])
self.assertEqual(uinfo.name, 'prj2')
示例11: test8
def test8(self):
"""test _calculate_updateinfo 2"""
path = self.fixture_file('prj2')
prj = Project(path)
uinfo = prj._calculate_updateinfo()
self.assertEqual(uinfo.candidates, ['foo', 'foo_modified'])
self.assertEqual(uinfo.added, ['osc'])
self.assertEqual(uinfo.deleted, ['abc', 'xxx', 'del'])
# local state: A
self.assertEqual(uinfo.conflicted, ['bar'])
示例12: test_revert3
def test_revert3(self):
"""revert a missing package"""
path = self.fixture_file('prj_revert')
prj = Project(path)
self.assertEqual(prj._status('xxx'), '!')
self._not_exists(path, 'xxx')
prj.revert('xxx')
self.assertEqual(prj._status('xxx'), ' ')
self._exists(path, 'xxx')
self._exists(path, 'xxx', 'dummy')
示例13: test_update10
def test_update10(self):
"""test update (rollback commit transaction)"""
path = self.fixture_file('prj2_update_rollback_commit')
self._exists(path, '.osc', '_transaction')
# the rest is identical to test_update1
prj = Project(path)
self.assertEqual(prj._status('foo'), ' ')
prj.update('foo', foo='bar')
self.assertEqual(prj._status('foo'), ' ')
self._not_exists(path, '.osc', '_transaction')
示例14: test8_1
def test8_1(self):
"""test _calculate_updateinfo 3 (specify packages)"""
path = self.fixture_file('prj2')
prj = Project(path)
uinfo = prj._calculate_updateinfo('foo', 'osc', 'del')
self.assertEqual(uinfo.candidates, ['foo'])
self.assertEqual(uinfo.added, ['osc'])
self.assertEqual(uinfo.deleted, ['del'])
# no conflicts because bar shouldn't be added/updated
self.assertEqual(uinfo.conflicted, [])
示例15: test_update5
def test_update5(self):
"""test update (add package)"""
path = self.fixture_file('prj1')
# it is ok to use the simple TL class because we have no
# duplicate keys (for instance a package and a file with the same name)
tl = TL(abort=False)
tl_abort = TL(abort=True)
prj = Project(path, transaction_listener=[tl, tl_abort])
self._not_exists(path, 'foo')
self.assertEqual(prj._status('foo'), '?')
prj.update('foo')
# no abort this time
tl = TL(abort=False)
prj = Project(path, transaction_listener=[tl])
self._not_exists(path, 'foo')
self.assertEqual(prj._status('foo'), '?')
prj.update('foo')
self.assertEqual(prj._status('foo'), ' ')
self._exists(path, 'foo')
self._exists(path, 'foo', 'file')
self._exists(path, '.osc', 'data', 'foo')
# check transaction listener
self.assertEqual(tl._begin, ['prj_update', 'update'])
self.assertEqual(tl._finished, ['update', 'prj_update'])
self.assertEqual(tl._transfer, [('download', 'file')])
keys = list(tl._processed.keys())
keys.sort()
self.assertEqual(keys, ['file', 'foo'])
self.assertEqual(tl._processed['file'], (' ', None))
self.assertEqual(tl._processed['foo'], (' ', None))