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 committed Apr 17, 2019
1 parent f55823b commit 9950ccf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions bumpversion/vcs.py
Expand Up @@ -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
Expand Down Expand Up @@ -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()
)
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Expand Up @@ -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:
Expand Down

0 comments on commit 9950ccf

Please sign in to comment.