本文整理汇总了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'))