Skip to content

Commit

Permalink
Try explicit encoding and suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Aug 3, 2024
1 parent ebecfb2 commit 3a81fe5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/mypy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def run_mypy(
env_vars = dict(os.environ)
if mypypath is not None:
env_vars["MYPYPATH"] = mypypath
with tempfile.NamedTemporaryFile("w+") as temp:
with tempfile.NamedTemporaryFile("w+", encoding="utf8", suffix=".ini") as temp:
temp.write("[mypy]\n")
for dist_conf in configurations:
temp.write(f"[mypy-{dist_conf.module_name}]\n")
Expand Down
2 changes: 1 addition & 1 deletion tests/stubtest_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def run_stubtest(typeshed_dir: Path) -> int:
# This is fine because we don't care about distutils and allowlist all errors from it
# https://github.com/python/typeshed/pull/10253#discussion_r1216712404
# https://github.com/python/typeshed/pull/9734
with tempfile.NamedTemporaryFile("w+") as temp:
with tempfile.NamedTemporaryFile("w+", encoding="utf8", suffix=".ini") as temp:
temp.write("[mypy]\ndisable_error_code = overload-overlap")
temp.flush()

Expand Down
5 changes: 4 additions & 1 deletion tests/stubtest_third_party.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def run_stubtest(
modules_to_check = [d.stem for d in dist.iterdir() if d.is_file() and d.suffix == ".pyi"]

config_file = Path(tmp, "mypy.ini")
config_file.write_text("[mypy]\ndisable_error_code = overload-overlap")
config_file.write_text(
"[mypy]\ndisable_error_code = overload-overlap",
encoding="utf8",
)

stubtest_cmd = [
python_exe,
Expand Down

0 comments on commit 3a81fe5

Please sign in to comment.