示例#1
0
    def test_write_git_changelog(self):
        exist_files = [
            os.path.join(self.root_dir, f) for f in (".git", ".mailmap")
        ]
        self.useFixture(
            fixtures.MonkeyPatch(
                "os.path.exists",
                lambda path: os.path.abspath(path) in exist_files))
        self.useFixture(
            fixtures.FakePopen(
                lambda _: {
                    "stdout":
                    BytesIO("Author: Foo Bar "
                            "<*****@*****.**>\n".encode('utf-8'))
                }))

        def _fake_read_git_mailmap(*args):
            return {"*****@*****.**": "*****@*****.**"}

        self.useFixture(
            fixtures.MonkeyPatch("pbr.packaging.read_git_mailmap",
                                 _fake_read_git_mailmap))

        packaging.write_git_changelog(git_dir=self.git_dir,
                                      dest_dir=self.temp_path)

        with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh:
            self.assertTrue("*****@*****.**" in ch_fh.read())
示例#2
0
    def test_write_git_changelog(self):
        self.useFixture(fixtures.FakePopen(lambda _: {"stdout": BytesIO(_changelog_content.encode("utf-8"))}))

        packaging.write_git_changelog(git_dir=self.git_dir, dest_dir=self.temp_path)

        with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh:
            changelog_contents = ch_fh.read()
            self.assertIn("2013.2", changelog_contents)
            self.assertIn("0.5.17", changelog_contents)
            self.assertIn("------", changelog_contents)
            self.assertIn("Refactor hooks file", changelog_contents)
            self.assertNotIn("Refactor hooks file.", changelog_contents)
            self.assertNotIn("182feb3", changelog_contents)
            self.assertNotIn("review/monty_taylor/27519", changelog_contents)
            self.assertNotIn("0.5.13", changelog_contents)
            self.assertNotIn('Merge "', changelog_contents)
示例#3
0
    def test_write_git_changelog(self):
        self.useFixture(fixtures.FakePopen(lambda _: {
            "stdout": BytesIO(_changelog_content.encode('utf-8'))
        }))

        packaging.write_git_changelog(git_dir=self.git_dir,
                                      dest_dir=self.temp_path)

        with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh:
            changelog_contents = ch_fh.read()
            self.assertIn("2013.2", changelog_contents)
            self.assertIn("0.5.17", changelog_contents)
            self.assertIn("------", changelog_contents)
            self.assertIn("Refactor hooks file", changelog_contents)
            self.assertNotIn("Refactor hooks file.", changelog_contents)
            self.assertNotIn("182feb3", changelog_contents)
            self.assertNotIn("review/monty_taylor/27519", changelog_contents)
            self.assertNotIn("0.5.13", changelog_contents)
            self.assertNotIn('Merge "', changelog_contents)
示例#4
0
文件: test_setup.py 项目: dprince/pbr
    def test_write_git_changelog(self):
        exist_files = [os.path.join(self.root_dir, f)
                       for f in ".git", ".mailmap"]
        self.useFixture(fixtures.MonkeyPatch(
            "os.path.exists",
            lambda path: os.path.abspath(path) in exist_files))
        self.useFixture(fixtures.FakePopen(lambda _: {
            "stdout": StringIO.StringIO("Author: Foo Bar <*****@*****.**>\n")
        }))

        def _fake_read_git_mailmap(*args):
            return {"*****@*****.**": "*****@*****.**"}

        self.useFixture(fixtures.MonkeyPatch("pbr.packaging.read_git_mailmap",
                                             _fake_read_git_mailmap))

        packaging.write_git_changelog(git_dir=self.git_dir,
                                      dest_dir=self.temp_path)

        with open(os.path.join(self.temp_path, "ChangeLog"), "r") as ch_fh:
            self.assertTrue("*****@*****.**" in ch_fh.read())