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


Python Config.name方法代码示例

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


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

示例1: test_perform_guesswork__ignore

# 需要导入模块: from pypackage.config import Config [as 别名]
# 或者: from pypackage.config.Config import name [as 别名]
def test_perform_guesswork__ignore(capfd, reset_sys_argv, move_home_pypackage):
    """If the user responds with 'all', ignore all guesses."""

    conf = Config()
    conf.name = "previously existing"
    sys.argv = ["py-build", "-i"]
    guesses = OrderedDict([
        ("name", "some name"),
        ("py_modules", "some_thing"),
        ("scripts", ["bin/something"]),
        ("package_data", {"some name": ["thing/data/file_1"]}),
    ])

    with mock.patch.object(guessing, "_guess_at_things", return_value=guesses):
        with mock.patch.object(guessing, "INPUT", return_value="all"):
            guessing.perform_guesswork(conf, get_options())

    assert conf.name == "previously existing"
    assert not hasattr(conf, "py_modules")
    assert not hasattr(conf, "package_data")
    assert not hasattr(conf, "scripts")

    out, err = capfd.readouterr()
    assert "ignoring all guesses" in out
    assert not err
开发者ID:a-tal,项目名称:pypackage,代码行数:27,代码来源:test_guessing.py

示例2: test_perform_guesswork

# 需要导入模块: from pypackage.config import Config [as 别名]
# 或者: from pypackage.config.Config import name [as 别名]
def test_perform_guesswork(capfd, reset_sys_argv, move_home_pypackage):
    """Ensure the user can deselect guesses when using interactive."""

    conf = Config()
    conf.name = "previously existing"
    sys.argv = ["py-build", "-i"]
    guesses = OrderedDict([
        ("name", "some name"),
        ("py_modules", "some_thing"),
        ("scripts", ["bin/something"]),
        ("package_data", ["thing/data/file_1"]),
    ])

    with mock.patch.object(guessing, "_guess_at_things", return_value=guesses):
        with mock.patch.object(guessing, "INPUT",
                               side_effect=iter(["1", "-3", "2", ""])):
            guessing.perform_guesswork(conf, get_options())

    assert conf.name == "previously existing"
    assert not hasattr(conf, "py_modules")
    assert conf.package_data == {"previously existing": ["thing/data/file_1"]}
    assert conf.scripts == ["bin/something"]

    out, err = capfd.readouterr()
    assert "name will not be guessed" in out
    assert "py_modules will not be guessed" in out

    assert not err
开发者ID:a-tal,项目名称:pypackage,代码行数:30,代码来源:test_guessing.py

示例3: test_standard_attributes__re_config

# 需要导入模块: from pypackage.config import Config [as 别名]
# 或者: from pypackage.config.Config import name [as 别名]
def test_standard_attributes__re_config(reset_sys_argv):
    """If reconfig is set, all standard attributes should be unconfigured."""

    conf = Config()
    conf.name = "something"
    sys.argv = ["py-build", "-r"]
    attrs = configure.standard_attributes(conf, get_options())
    expected = list(conf._KEYS.keys())[:conf._STD_TO_EXTD_INDEX]
    assert attrs == expected
开发者ID:ccpgames,项目名称:pypackage,代码行数:11,代码来源:test_configure.py

示例4: test_standard_attributes

# 需要导入模块: from pypackage.config import Config [as 别名]
# 或者: from pypackage.config.Config import name [as 别名]
def test_standard_attributes(reset_sys_argv, move_home_pypackage):
    """Ensure the standard attribute set."""

    conf = Config()
    expected_attrs = list(conf._KEYS.keys())[:conf._STD_TO_EXTD_INDEX]
    conf.name = "foobar"
    conf.classifiers = ["fake classifier"]
    expected_attrs.remove("name")
    expected_attrs.remove("classifiers")
    attrs = configure.standard_attributes(conf, get_options())
    assert attrs == expected_attrs
开发者ID:ccpgames,项目名称:pypackage,代码行数:13,代码来源:test_configure.py

示例5: test_additional_tests_require

# 需要导入模块: from pypackage.config import Config [as 别名]
# 或者: from pypackage.config.Config import name [as 别名]
def test_additional_tests_require(runner):
    """If there are provided tests_require, they should be mixed in."""

    # we get runner-cov here becuase we provide a name
    conf = Config(name="test", test_runner=runner, tests_require=["my_thing"])
    assert conf.tests_require == ["my_thing", runner, "{}-cov".format(runner)]
    assert conf.runner_args[-1] == "test"
    # change our name here, we should get our new name in runner_args
    conf.name = "changed"
    # also we can reset tests_require and they should re-populate
    conf.tests_require = ["my_thing"]
    conf._verify()
    assert conf.runner_args[-1] == "changed"
开发者ID:a-tal,项目名称:pypackage,代码行数:15,代码来源:test_config.py


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