Skip to content

Commit

Permalink
Fix a text decoding issue
Browse files Browse the repository at this point in the history
This was behaving differently between Python 2 and 3, causing
test 'test_dirty_work_dir' to fail in one of both.
  • Loading branch information
florisla authored and c4urself committed Jun 8, 2019
1 parent 08763bb commit 1fea937
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions bumpversion/vcs.py
Expand Up @@ -74,7 +74,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
Expand Down Expand Up @@ -150,7 +152,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()
)
)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Expand Up @@ -411,8 +411,8 @@ def test_dirty_work_dir(tmpdir, vcs):
tmpdir.join("dirty").write("i'm dirty")

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_name = "Mercurial" if vcs == "hg" else "Git"
vcs_output = "A dirty" if vcs == "hg" else "A dirty"

with pytest.raises(WorkingDirectoryIsDirtyException):
with LogCapture() as log_capture:
Expand Down

0 comments on commit 1fea937

Please sign in to comment.