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


Python Project.include_file方法代码示例

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


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

示例1: create_project

# 需要导入模块: from pybuilder.core import Project [as 别名]
# 或者: from pybuilder.core.Project import include_file [as 别名]
def create_project():
    project = Project("/")
    project.build_depends_on("testingframework")
    project.depends_on("sometool")
    project.depends_on(
        "pyassert", url="https://github.com/downloads/halimath/pyassert/pyassert-0.2.2.tar.gz")
    project.name = "Spam and Eggs"
    project.version = "1.2.3"
    project.summary = "This is a simple integration-test for distutils plugin."
    project.description = "As you might have guessed we have nothing to say here."
    project.authors = [
        Author("Udo Juettner", "[email protected]"), Author("Michael Gruber", "[email protected]")]
    project.license = "WTFPL"
    project.url = "http://github.com/pybuilder/pybuilder"

    def return_dummy_list():
        return ["spam", "eggs"]

    project.list_scripts = return_dummy_list
    project.list_packages = return_dummy_list
    project.list_modules = return_dummy_list

    project.set_property("distutils_classifiers", [
        "Development Status :: 5 - Beta", "Environment :: Console"])
    project.install_file("dir", "file1")
    project.install_file("dir", "file2")
    project.include_file("spam", "eggs")

    return project
开发者ID:Lucas-C,项目名称:pybuilder,代码行数:31,代码来源:distutils_plugin_tests.py

示例2: ProjectPackageDataTests

# 需要导入模块: from pybuilder.core import Project [as 别名]
# 或者: from pybuilder.core.Project import include_file [as 别名]
class ProjectPackageDataTests(unittest.TestCase):
    def setUp(self):
        self.project = Project(basedir="/imaginary", name="Unittest")

    def test_should_raise_exception_when_package_name_not_given(self):
        self.assertRaises(ValueError, self.project.include_file, None, "spam")

    def test_should_raise_exception_when_filename_not_given(self):
        self.assertRaises(
            ValueError, self.project.include_file, "my_package", None)

    def test_should_raise_exception_when_package_name_is_empty_string(self):
        self.assertRaises(
            ValueError, self.project.include_file, "    \n", "spam")

    def test_should_raise_exception_when_filename_is_empty_string(self):
        self.assertRaises(
            ValueError, self.project.include_file, "eggs", "\t    \n")

    def test_should_raise_exception_when_package_path_not_given(self):
        self.assertRaises(ValueError, self.project.include_directory, None, "spam")

    def test_should_raise_exception_when_package_path_is_empty_string(self):
        self.assertRaises(ValueError, self.project.include_directory, "\t  \n", "spam")

    def test_should_raise_exception_when_patterns_list_not_given(self):
        self.assertRaises(ValueError, self.project.include_directory, "spam", None)

    def test_should_raise_exception_when_patterns_list_is_empty_list(self):
        self.assertRaises(ValueError, self.project.include_directory, "spam", ["\t   \n"])

    def test_should_package_data_dictionary_is_empty(self):
        self.assertEquals({}, self.project.package_data)

    def test_should_add_filename_to_list_of_included_files_for_package_spam(self):
        self.project.include_file("spam", "eggs")

        self.assertEquals({"spam": ["eggs"]}, self.project.package_data)

    def test_should_add_two_filenames_to_list_of_included_files_for_package_spam(self):
        self.project.include_file("spam", "eggs")
        self.project.include_file("spam", "ham")

        self.assertEquals({"spam": ["eggs", "ham"]}, self.project.package_data)

    def test_should_add_two_filenames_to_list_of_included_files_for_two_different_packages(self):
        self.project.include_file("spam", "eggs")
        self.project.include_file("monty", "ham")

        self.assertEquals(
            {"monty": ["ham"], "spam": ["eggs"]}, self.project.package_data)

    def test_should_add_two_filenames_to_list_of_included_files_and_to_manifest(self):
        self.project.include_file("spam", "eggs")
        self.project.include_file("monty", "ham")

        self.assertEquals(
            {"monty": ["ham"], "spam": ["eggs"]}, self.project.package_data)
        self.assertEquals(
            ["spam/eggs", "monty/ham"], self.project.manifest_included_files)
开发者ID:0xD3ADB33F,项目名称:pybuilder,代码行数:62,代码来源:core_tests.py

示例3: BuildPackageDataStringTest

# 需要导入模块: from pybuilder.core import Project [as 别名]
# 或者: from pybuilder.core.Project import include_file [as 别名]
class BuildPackageDataStringTest(unittest.TestCase):
    def setUp(self):
        self.project = Project('.')

    def test_should_return_empty_package_data_string_when_no_files_to_include_given(self):
        self.assertEqual('{}', build_package_data_string(self.project))

    def test_should_return_package_data_string_when_including_file(self):
        self.project.include_file("spam", "egg")

        self.assertEqual(
            "{\n"
            "            'spam': ['egg']\n"
            "        }", build_package_data_string(self.project))

    def test_should_return_package_data_string_when_including_three_files(self):
        self.project.include_file("spam", "egg")
        self.project.include_file("ham", "eggs")
        self.project.include_file("monty", "python")

        self.assertEqual("{\n"
                         "            'ham': ['eggs'],\n"
                         "            'monty': ['python'],\n"
                         "            'spam': ['egg']\n"
                         "        }", build_package_data_string(self.project))

    def test_should_return_package_data_string_with_keys_in_alphabetical_order(self):
        self.project.include_file("b", "beta")
        self.project.include_file("m", "Mu")
        self.project.include_file("e", "epsilon")
        self.project.include_file("k", "Kappa")
        self.project.include_file("p", "psi")
        self.project.include_file("z", "Zeta")
        self.project.include_file("i", "Iota")
        self.project.include_file("a", "alpha")
        self.project.include_file("d", "delta")
        self.project.include_file("t", "theta")
        self.project.include_file("l", "lambda")
        self.project.include_file("x", "chi")

        self.assertEqual("{\n"
                         "            'a': ['alpha'],\n"
                         "            'b': ['beta'],\n"
                         "            'd': ['delta'],\n"
                         "            'e': ['epsilon'],\n"
                         "            'i': ['Iota'],\n"
                         "            'k': ['Kappa'],\n"
                         "            'l': ['lambda'],\n"
                         "            'm': ['Mu'],\n"
                         "            'p': ['psi'],\n"
                         "            't': ['theta'],\n"
                         "            'x': ['chi'],\n"
                         "            'z': ['Zeta']\n"
                         "        }", build_package_data_string(self.project))
开发者ID:Lucas-C,项目名称:pybuilder,代码行数:56,代码来源:distutils_plugin_tests.py


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