mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-05 13:20:11 +00:00
On Python 3.9, Popen passes encoding=None, not "locale", to TextIOWrapper, so simulated_cp1252 changed nothing and the encoding regressions could not catch a missing encoding="utf-8". The stdout newline test used Path.write_text(newline=...), which needs 3.10. Co-Authored-By: Claude Opus 5.5 <[email protected]>
34 lines
1000 B
Python
34 lines
1000 B
Python
from pathlib import Path
|
|
import subprocess
|
|
import sys
|
|
import tempfile
|
|
import unittest
|
|
|
|
tools = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
class StubgenStdoutNewlineTests(unittest.TestCase):
|
|
def run_stubgen(self, *extra):
|
|
with tempfile.TemporaryDirectory() as d:
|
|
nids = Path(d) / "nids.txt"
|
|
nids.write_bytes(b"AC1FtjqMCL0\n")
|
|
return subprocess.run(
|
|
[sys.executable, str(tools / "stubgen.py"), "--module", "libkernel", "--nids", str(nids)] + list(extra),
|
|
capture_output=True,
|
|
check=True,
|
|
)
|
|
|
|
def test_code_on_stdout_uses_lf(self):
|
|
result = self.run_stubgen()
|
|
self.assertIn(b"\n", result.stdout)
|
|
self.assertNotIn(b"\r\n", result.stdout)
|
|
|
|
def test_td_only_on_stdout_uses_lf(self):
|
|
result = self.run_stubgen("--td-only")
|
|
self.assertIn(b"\n", result.stdout)
|
|
self.assertNotIn(b"\r\n", result.stdout)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|