From 9950ccf5469571cd731cb31393e097fdfd841101 Mon Sep 17 00:00:00 2001 From: Floris Lambrechts Date: Wed, 17 Apr 2019 21:43:32 +0200 Subject: [PATCH] Fix a text decoding issue This was behaving differently between Python 2 and 3, causing test 'test_dirty_work_dir' to fail in one of both. --- bumpversion/vcs.py | 6 ++++-- tests/test_cli.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/bumpversion/vcs.py b/bumpversion/vcs.py index c5516f4..6538234 100644 --- a/bumpversion/vcs.py +++ b/bumpversion/vcs.py @@ -67,7 +67,9 @@ def assert_nondirty(cls): if lines: raise WorkingDirectoryIsDirtyException( - "Git working directory is not clean:\n{}".format(b"\n".join(lines)) + "Git working directory is not clean:\n{}".format( + b"\n".join(lines).decode() + ) ) @classmethod @@ -143,7 +145,7 @@ def assert_nondirty(cls): if lines: raise WorkingDirectoryIsDirtyException( "Mercurial working directory is not clean:\n{}".format( - b"\n".join(lines) + b"\n".join(lines).decode() ) ) diff --git a/tests/test_cli.py b/tests/test_cli.py index 28aacad..5b5addf 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -412,7 +412,7 @@ def test_dirty_work_dir(tmpdir, vcs): check_call([vcs, "add", "dirty"]) vcs_name = "Mercurial" if vcs == "hg" else "Git" - vcs_output = "b'A dirty'" if vcs == "hg" else "b'A dirty'" + vcs_output = "A dirty" if vcs == "hg" else "A dirty" with pytest.raises(WorkingDirectoryIsDirtyException): with LogCapture() as log_capture: