本文整理匯總了Python中dulwich.server.FileSystemBackend.open_repository方法的典型用法代碼示例。如果您正苦於以下問題:Python FileSystemBackend.open_repository方法的具體用法?Python FileSystemBackend.open_repository怎麽用?Python FileSystemBackend.open_repository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dulwich.server.FileSystemBackend
的用法示例。
在下文中一共展示了FileSystemBackend.open_repository方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FileSystemBackendTests
# 需要導入模塊: from dulwich.server import FileSystemBackend [as 別名]
# 或者: from dulwich.server.FileSystemBackend import open_repository [as 別名]
class FileSystemBackendTests(TestCase):
"""Tests for FileSystemBackend."""
def setUp(self):
super(FileSystemBackendTests, self).setUp()
self.path = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, self.path)
self.repo = Repo.init(self.path)
self.backend = FileSystemBackend()
def test_nonexistant(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, "/does/not/exist/unless/foo")
def test_absolute(self):
repo = self.backend.open_repository(self.path)
self.assertEqual(
os.path.normcase(os.path.abspath(repo.path)),
os.path.normcase(os.path.abspath(self.repo.path)))
def test_child(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, os.path.join(self.path, "foo"))
def test_bad_repo_path(self):
backend = FileSystemBackend()
self.assertRaises(NotGitRepository,
lambda: backend.open_repository('/ups'))
示例2: FileSystemBackendTests
# 需要導入模塊: from dulwich.server import FileSystemBackend [as 別名]
# 或者: from dulwich.server.FileSystemBackend import open_repository [as 別名]
class FileSystemBackendTests(TestCase):
"""Tests for FileSystemBackend."""
def setUp(self):
super(FileSystemBackendTests, self).setUp()
self.path = tempfile.mkdtemp()
self.repo = Repo.init(self.path)
self.backend = FileSystemBackend()
def test_nonexistant(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, "/does/not/exist/unless/foo")
def test_absolute(self):
repo = self.backend.open_repository(self.path)
self.assertEqual(repo.path, self.repo.path)
def test_child(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, os.path.join(self.path, "foo"))
def test_bad_repo_path(self):
repo = MemoryRepo.init_bare([], {})
backend = DictBackend({'/': repo})
self.assertRaises(NotGitRepository,
lambda: backend.open_repository('/ups'))
示例3: FileSystemBackendTests
# 需要導入模塊: from dulwich.server import FileSystemBackend [as 別名]
# 或者: from dulwich.server.FileSystemBackend import open_repository [as 別名]
class FileSystemBackendTests(TestCase):
"""Tests for FileSystemBackend."""
def setUp(self):
super(FileSystemBackendTests, self).setUp()
self.path = tempfile.mkdtemp()
self.repo = Repo.init(self.path)
self.backend = FileSystemBackend()
def test_nonexistant(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, "/does/not/exist/unless/foo")
def test_absolute(self):
repo = self.backend.open_repository(self.path)
self.assertEquals(repo.path, self.repo.path)
def test_child(self):
self.assertRaises(NotGitRepository,
self.backend.open_repository, os.path.join(self.path, "foo"))
示例4: test_bad_repo_path
# 需要導入模塊: from dulwich.server import FileSystemBackend [as 別名]
# 或者: from dulwich.server.FileSystemBackend import open_repository [as 別名]
def test_bad_repo_path(self):
backend = FileSystemBackend()
self.assertRaises(NotGitRepository,
lambda: backend.open_repository('/ups'))