本文整理汇总了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
示例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
示例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
示例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
示例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"