当前位置: 首页>>代码示例>>Python>>正文


Python VoluminousOptions.parseOptions方法代码示例

本文整理汇总了Python中dvol.VoluminousOptions.parseOptions方法的典型用法代码示例。如果您正苦于以下问题:Python VoluminousOptions.parseOptions方法的具体用法?Python VoluminousOptions.parseOptions怎么用?Python VoluminousOptions.parseOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dvol.VoluminousOptions的用法示例。


在下文中一共展示了VoluminousOptions.parseOptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_create_volume_already_exists

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume_already_exists(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(["-p", self.tmpdir.path, "init", "foo"])
     self.assertRaises(VolumeAlreadyExists,
             dvol.parseOptions, ["-p", self.tmpdir.path, "init", "foo"])
     self.assertEqual(dvol.voluminous.getOutput(),
             ["Error: volume foo already exists"])
开发者ID:CorcovadoMing,项目名称:dvol,代码行数:9,代码来源:test_dvol.py

示例2: test_list_empty_volumes

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_list_empty_volumes(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "list"])
     self.assertIn(
         dvol.voluminous.getOutput()[-1].strip(),
         "  VOLUME   BRANCH   CONTAINERS"
     )
开发者ID:lalyos,项目名称:dvol,代码行数:9,代码来源:test_dvol.py

示例3: test_create_volume_already_exists

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume_already_exists(self):
     dvol = VoluminousOptions()
     # Create the repository twice, second time should have the error
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     self.assertEqual(dvol.voluminous.getOutput()[-1],
             "Error: volume foo already exists")
开发者ID:ienliven,项目名称:dvol,代码行数:9,代码来源:test_dvol.py

示例4: test_remove_volume_path_separator

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_remove_volume_path_separator(self):
     dvol = VoluminousOptions()
     try:
         dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "rm", "-f", "foo/bar"])
         output = dvol.voluminous.getOutput()[-1]
     except CalledProcessErrorWithOutput, error:
         output = error.original.output
开发者ID:lalyos,项目名称:dvol,代码行数:9,代码来源:test_dvol.py

示例5: test_create_volume

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     self.assertTrue(self.tmpdir.child("foo").exists())
     self.assertTrue(self.tmpdir.child("foo").child("branches")
             .child("master").exists())
     self.assertEqual(dvol.voluminous.getOutput()[-1],
             "Created volume foo\nCreated branch foo/master")
开发者ID:ienliven,项目名称:dvol,代码行数:10,代码来源:test_dvol.py

示例6: test_get_set_config

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_get_set_config(self):
     """
     A configuration key can be set and then retrieved.
     """
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "config", "user.name", "alice"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "config", "user.name"])
     self.assertEqual(dvol.voluminous.getOutput()[-1],
         "alice")
开发者ID:ClusterHQ,项目名称:dvol,代码行数:11,代码来源:test_dvol.py

示例7: test_create_volume

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume(self):
     # TODO test volume names with '/' in them - they should not end up
     # making nested heirarchy
     dvol = VoluminousOptions()
     dvol.parseOptions(["-p", self.tmpdir.path, "init", "foo"])
     self.assertTrue(self.tmpdir.child("foo").exists())
     self.assertTrue(self.tmpdir.child("foo").child("branches")
             .child("master").exists())
     self.assertEqual(dvol.voluminous.getOutput(),
             ["Created volume foo", "Created branch foo/master"])
开发者ID:CorcovadoMing,项目名称:dvol,代码行数:12,代码来源:test_dvol.py

示例8: test_switch_volume_does_not_exist

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_switch_volume_does_not_exist(self):
     """
     ``dvol switch`` should give a meaningful error message if the
     volume we try to switch to doesn't exist.
     """
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     try:
         dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "switch", "bar"])
     except CalledProcessErrorWithOutput, error:
         self.assertEqual(error.original.output.rstrip(), "Error: bar does not exist")
开发者ID:lalyos,项目名称:dvol,代码行数:13,代码来源:test_dvol.py

示例9: test_create_volume_already_exists

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume_already_exists(self):
     dvol = VoluminousOptions()
     # Create the repository twice, second time should have the error
     expected_output = "Error: volume foo already exists"
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     try:
         dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
         self.assertEqual(dvol.voluminous.getOutput()[-1], expected_output)
     except CalledProcessErrorWithOutput, error:
         self.assertIn(expected_output, error.original.output)
         self.assertTrue(error.original.returncode != 0)
开发者ID:lalyos,项目名称:dvol,代码行数:13,代码来源:test_dvol.py

示例10: test_commit_no_message_raises_error

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_commit_no_message_raises_error(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     try:
         dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "commit"])
         # TODO assert exit code != 0
         self.assertTrue(dvol.voluminous.getOutput()[-1].strip().endswith(
                 "You must provide a commit message"))
     except UsageError:
         # in non-out-of-process case, we'll get this exception. This is OK.
         pass
开发者ID:lalyos,项目名称:dvol,代码行数:13,代码来源:test_dvol.py

示例11: test_log

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_log(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "init", "foo"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "commit", "-m", "oi"])
     first_commit = dvol.voluminous.getOutput()[-1]
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "commit", "-m", "you"])
     second_commit = dvol.voluminous.getOutput()[-1]
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "log"])
     actual = dvol.voluminous.getOutput()[-1]
     expected = (
         "commit {second_commit}\n"
         "Author: Who knows <[email protected]>\n"
         "Date: Whenever\n"
         "\n"
         "    you\n"
         "\n"
         "commit {first_commit}\n"
         "Author: Who knows <[email protected]>\n"
         "Date: Whenever\n"
         "\n"
         "    oi\n").format(
             first_commit=first_commit,
             second_commit=second_commit
         )
     expectedLines = expected.split("\n")
     actualLines = actual.split("\n")
     self.assertEqual(len(expectedLines), len(actualLines))
     for expected, actual in zip(
             expectedLines, actualLines):
         self.assertTrue(actual.startswith(expected))
开发者ID:ClusterHQ,项目名称:dvol,代码行数:36,代码来源:test_dvol.py

示例12: test_branch_multi_volumes

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
    def test_branch_multi_volumes(self, volumes):
        """
        Always show the last checked-out branch for all volumes in ``list``.
        """
        tmpdir = FilePath(self.mktemp())
        tmpdir.makedirs()

        dvol = VoluminousOptions()
        for volume, branch in volumes:
            dvol.parseOptions(ARGS + ["-p", tmpdir.path, "init", volume])
            dvol.parseOptions(ARGS + ["-p", tmpdir.path, "commit", "-m", "hello"])
            dvol.parseOptions(ARGS + ["-p", tmpdir.path, "checkout", "-b", branch])

        dvol.parseOptions(ARGS + ["-p", tmpdir.path, "list"])
        lines = dvol.voluminous.getOutput()[-1].split("\n")
        header, rest = lines[0], lines[1:]

        expected_volumes = [[volume, branch] for volume, branch in volumes]
        # `init` activates the volume, so the last initialized volume is the
        # active one.
        expected_volumes[-1] = [
            '*', expected_volumes[-1][0], expected_volumes[-1][1]]
        self.assertEqual(['VOLUME', 'BRANCH', 'CONTAINERS'], header.split())
        self.assertEqual(
            sorted(expected_volumes),
            sorted([line.split() for line in rest]),
        )
开发者ID:lalyos,项目名称:dvol,代码行数:29,代码来源:test_dvol.py

示例13: test_log

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_log(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "init", "foo"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "commit", "-m", "oi"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "commit", "-m", "you"])
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path,
         "log"])
     actual = dvol.voluminous.getOutput()[-1]
     expected = (
         "commit\n"
         "Author:\n"
         "Date:\n"
         "\n"
         "    you\n"
         "\n"
         "commit\n"
         "Author:\n"
         "Date:\n"
         "\n"
         "    oi\n")
     expectedLines = expected.split("\n")
     actualLines = actual.split("\n")
     self.assertEqual(len(expectedLines), len(actualLines))
     for expected, actual in zip(
             expectedLines, actualLines):
         self.assertTrue(actual.startswith(expected))
开发者ID:lalyos,项目名称:dvol,代码行数:31,代码来源:test_dvol.py

示例14: test_commit_no_message_raises_error

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_commit_no_message_raises_error(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     # TODO after throwing away python version, make this test stricter
     # about exit code != 0
     try:
         try:
             dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "commit"])
         except CalledProcessErrorWithOutput, error: # go version
             expected_output = "You must provide a commit message"
             self.assertIn(expected_output, error.original.output)
             self.assertTrue(error.original.returncode != 0)
     except UsageError: # python version
         # in non-out-of-process case, we'll get this exception. This is OK.
         pass
开发者ID:ClusterHQ,项目名称:dvol,代码行数:17,代码来源:test_dvol.py

示例15: test_create_volume

# 需要导入模块: from dvol import VoluminousOptions [as 别名]
# 或者: from dvol.VoluminousOptions import parseOptions [as 别名]
 def test_create_volume(self):
     dvol = VoluminousOptions()
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "init", "foo"])
     self.assertTrue(self.tmpdir.child("foo").exists())
     self.assertTrue(self.tmpdir.child("foo").child("branches")
             .child("master").exists())
     self.assertEqual(dvol.voluminous.getOutput()[-1],
             "Created volume foo\nCreated branch foo/master")
     # Verify operation with `list`
     dvol.parseOptions(ARGS + ["-p", self.tmpdir.path, "list"])
     header, rest = self._parse_list_output(dvol)
     expected_volumes = [["*", "foo", "master"]]
     self.assertEqual(
         sorted(expected_volumes),
         sorted(rest),
     )
开发者ID:lalyos,项目名称:dvol,代码行数:18,代码来源:test_dvol.py


注:本文中的dvol.VoluminousOptions.parseOptions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。