Пример #1
0
    def test_load_null_project(self):
        log = FakeLogger()
        ctx = Context(log=log)
        path = os.path.join(TEST_DATA_DIR, "null_project",
                            ctx.project_descriptor_name)
        project = ctx.parse_project_descriptor(path)
        settings = project.settings

        self.assertEqual(project.organization, "no-organization")
        self.assertEqual(project.name, "no-name")
        self.assertEqual(project.version, "no-version")
        self.assertEqual(project.description, "No description")
        self.assertEqual(project.url, "No url")
        self.assertEqual(project.license, "No license")
        self.assertEqual(project.authors, [])
        self.assertEqual(project.dependencies, [])

        self.assertEqual(settings.min_version, "0.0.1")
        self.assertEqual(settings.plugins, [])
        self.assertEqual(settings.repositories, [])
        self.assertEqual(settings.plugin_repositories, [])
        self.assertEqual(settings.entry_point, ["no-name/main.py", "main"])
        self.assertEqual(settings.python_cmd, "python3")
        self.assertEqual(settings.python_opts, [])
        self.assertEqual(settings.packages, ["no-name"])
        self.assertEqual(settings.test_paths, ["test"])
        self.assertEqual(settings.resource_paths, ["resources"])
        self.assertEqual(settings.target_path, "target")
        self.assertEqual(settings.python_versions, [])
Пример #2
0
    def test_load_project(self):
        log = FakeLogger()
        ctx = Context(log=log)
        path = os.path.join(TEST_DATA_DIR, ctx.project_descriptor_name)
        project = ctx.parse_project_descriptor(path)
        settings = project.settings

        self.assertEqual(project.organization, "pebete")
        self.assertEqual(project.name, "pbt")
        self.assertEqual(project.version, "0.0.1")
        self.assertEqual(project.description, "python build tool")
        self.assertEqual(project.url, "https://github.com/pebete/pbt")
        self.assertEqual(project.license, {
            "name": "Apache 2.0",
            "url": "http://opensource.org/licenses/Apache-2.0"
            })
        self.assertEqual(project.authors, [
            "Mariano Guerra <mariano@marianoguerra>", "x-ip", "joac", "L1pe"
            ])
        self.assertEqual(project.dependencies, [
            ["org.python", "requests", "2.0.0"]
            ])

        self.assertEqual(settings.min_version, "0.0.1")
        self.assertEqual(settings.plugins, [
            ["marianoguerra", "sphinx", "1.0.0"]
            ])
        self.assertEqual(settings.repositories, [
            ["pypi", "http:/pypi.python.org/"]
            ])
        self.assertEqual(settings.plugin_repositories, [
            ["pypi", "http:/pypi.python.org/"]
            ])
        self.assertEqual(settings.entry_point, ["src/pbt_cli.py", "run"])
        self.assertEqual(settings.python_cmd, "~/bin/pypy")
        self.assertEqual(settings.python_opts, ["-tt"])
        self.assertEqual(settings.packages, ["null"])
        self.assertEqual(settings.test_paths, ["test"])
        self.assertEqual(settings.resource_paths, ["resources"])
        self.assertEqual(settings.target_path, "target")
        self.assertEqual(settings.python_versions, ["2.6", "2.7", "3.3", "3.4",
                                                    ["pypy", "2.1"]])