File tree 7 files changed +24
-14
lines changed
packages/navigate_editable/python/shared_pkg
7 files changed +24
-14
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ def each_unignored_file(
44
44
exclude_lines += f .readlines ()
45
45
46
46
nested_excludes = {
47
- p .parent : pathspec .GitIgnoreSpec .from_lines (p .read_text ().splitlines ())
47
+ p .parent : pathspec .GitIgnoreSpec .from_lines (
48
+ p .read_text (encoding = "utf-8" ).splitlines ()
49
+ )
48
50
for p in Path ().rglob ("**/.gitignore" )
49
51
if p != Path (".gitignore" )
50
52
}
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def load_reply_dir(reply_dir: Path) -> Index:
57
57
msg = f"index file not found in { reply_dir } "
58
58
raise IndexError (msg )
59
59
index_file = indexes [- 1 ]
60
- return converter .loads (index_file .read_text (), Index )
60
+ return converter .loads (index_file .read_text ("utf-8" ), Index )
61
61
62
62
63
63
if __name__ == "__main__" :
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ def py_method():
19
19
def read_py_data_txt ():
20
20
root = files ("shared_pkg.data" )
21
21
py_data = root / "py_data.txt"
22
- print (py_data .read_text ())
22
+ print (py_data .read_text (encoding = "utf-8" ))
23
23
24
24
25
25
def read_c_generated_txt ():
26
26
root = files ("shared_pkg.data" )
27
27
c_generated_txt = root / "c_generated.txt"
28
- print (c_generated_txt .read_text ())
28
+ print (c_generated_txt .read_text (encoding = "utf-8" ))
Original file line number Diff line number Diff line change 17
17
18
18
@pytest .mark .parametrize ("filename" , FILENAMES , ids = IDS )
19
19
def test_cmake_file_parse (filename : Path ):
20
- for x in parse (tokenize (filename .read_text (encoding = "utf-8-sig " ))):
20
+ for x in parse (tokenize (filename .read_text (encoding = "utf-8" ))):
21
21
assert str (x ).startswith (f"{ x .name } ({ x .value } )" )
22
22
23
23
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ def test_init_cache(
107
107
cmake_init = config .build_dir / "CMakeInit.txt"
108
108
source_dir_str = str (config .source_dir ).replace ("\\ " , "/" )
109
109
assert (
110
- cmake_init .read_text ()
110
+ cmake_init .read_text (encoding = "utf-8" )
111
111
== f"""\
112
112
set(SKBUILD ON CACHE BOOL "" FORCE)
113
113
set(SKBUILD_VERSION [===[1.0.0]===] CACHE STRING "" FORCE)
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def test_ep(isolated):
20
20
21
21
script = isolated .run ("script1" , capture = True ).strip ()
22
22
pysys = isolated .execute ("import sys; print(sys.executable)" ).strip ()
23
- contents = Path (script ).read_text ()
23
+ contents = Path (script ).read_text (encoding = "utf-8" )
24
24
assert contents .startswith (f"#!{ pysys } " )
25
25
26
26
if sys .version_info >= (3 , 8 ):
Original file line number Diff line number Diff line change @@ -33,18 +33,26 @@ def test_script_dir(tmp_path: Path) -> None:
33
33
34
34
process_script_dir (script_dir )
35
35
36
- assert script_1 .read_text () == "#!python\n \n print('hello world')"
36
+ assert script_1 .read_text (encoding = "utf-8" ) == "#!python\n \n print('hello world')"
37
37
assert script_1 .stat ().st_mode == orig_mode_1
38
38
39
- assert script_2 .read_text () == "#!python\n \n print('hello world')"
39
+ assert script_2 .read_text (encoding = "utf-8" ) == "#!python\n \n print('hello world')"
40
40
assert script_2 .stat ().st_mode == orig_mode_2
41
41
42
- assert script_3 .read_text () == "#!python\n \n print('hello world')"
42
+ assert script_3 .read_text (encoding = "utf-8" ) == "#!python\n \n print('hello world')"
43
43
44
- assert script_4 .read_text () == "#!python\n \n print('hello world')"
44
+ assert script_4 .read_text (encoding = "utf-8" ) == "#!python\n \n print('hello world')"
45
45
46
- assert script_5 .read_text () == "#!/usr/bin/other\n \n print('hello world')"
46
+ assert (
47
+ script_5 .read_text (encoding = "utf-8" )
48
+ == "#!/usr/bin/other\n \n print('hello world')"
49
+ )
47
50
48
- assert script_6 .read_text () == "#!python other\n \n print('hello world')"
51
+ assert (
52
+ script_6 .read_text (encoding = "utf-8" ) == "#!python other\n \n print('hello world')"
53
+ )
49
54
50
- assert script_7 .read_text () == "#!/usr/bin/env other\n \n print('hello world')"
55
+ assert (
56
+ script_7 .read_text (encoding = "utf-8" )
57
+ == "#!/usr/bin/env other\n \n print('hello world')"
58
+ )
You can’t perform that action at this time.
0 commit comments