Skip to content

Commit 6095ea3

Browse files
committed
Parametrize test_filename_with_special_chars
Use CP-1252 and CP-1251 filenames separately, skip the test on Windows on < 3.6 as it won't pass
1 parent 7961889 commit 6095ea3

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

pandas/tests/io/parser/test_common.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"""
77

88
import codecs
9-
import ctypes
109
from collections import OrderedDict
1110
import csv
1211
from datetime import datetime
@@ -1905,20 +1904,15 @@ def test_suppress_error_output(all_parsers, capsys):
19051904
assert captured.err == ""
19061905

19071906

1908-
def __windows_ansi_encoding_not_cp1252():
1909-
if compat.is_platform_windows():
1910-
ansi_codepage = ctypes.cdll.kernel32.GetACP()
1911-
return ansi_codepage != 1252 and not compat.PY36
1912-
return False
1913-
1914-
@pytest.mark.skipif(__windows_ansi_encoding_not_cp1252(),
1915-
reason="On Python < 3.6 won't pass on non-1252 codepage")
1916-
def test_filename_with_special_chars(all_parsers):
1907+
@pytest.mark.skipif(compat.is_platform_windows() and not compat.PY36,
1908+
reason="On Python < 3.6 won't pass on Windows")
1909+
@pytest.mark.parametrize("filename", ["sé-es-vé.csv", "ru-sй.csv"])
1910+
def test_filename_with_special_chars(all_parsers, filename):
19171911
# see gh-15086.
19181912
parser = all_parsers
19191913
df = DataFrame({"a": [1, 2, 3]})
19201914

1921-
with tm.ensure_clean("sé-es-vé-sй.csv") as path:
1915+
with tm.ensure_clean(filename) as path:
19221916
df.to_csv(path, index=False)
19231917

19241918
result = parser.read_csv(path)

0 commit comments

Comments
 (0)