Skip to content

Commit fc02230

Browse files
committed
Report encoding error in test_add_unicode as error
This makes the test explicitly error out, rather than skipping, if it appears the environment doesn't support encoding Unicode filenames. Platforms these days should be capable of that, and reporting it as an error lessens the risk of missing a bug in the test code (that method or a fixture) if one is ever introduced. Erroring out will also make it easier to see the details in the chained UnicodeDecodeError exception. This does not affect the behavior of GitPython itself. It only changes how a test reports an unusual condition that keeps the test\ from being usefully run.
1 parent c6a586a commit fc02230

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import os
88
import sys
99
import tempfile
10-
from unittest import SkipTest, skipIf
10+
from unittest import skipIf
1111

1212
from git import Repo
1313
from git.objects import Blob, Tree, Commit, TagObject
@@ -126,7 +126,7 @@ def test_add_unicode(self, rw_repo):
126126
try:
127127
file_path.encode(sys.getfilesystemencoding())
128128
except UnicodeEncodeError as e:
129-
raise SkipTest("Environment doesn't support unicode filenames") from e
129+
raise RuntimeError("Environment doesn't support unicode filenames") from e
130130

131131
with open(file_path, "wb") as fp:
132132
fp.write(b"something")

0 commit comments

Comments
 (0)