MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / test_cli_subprocess_integration

Function test_cli_subprocess_integration

python/tests/test_cli.py:159–187  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

157
158
159def test_cli_subprocess_integration(tmp_path):
160 input_path = tmp_path / 'input.txt'
161 output_path = tmp_path / 'output.txt'
162 resource_zip = tmp_path / 'opencc-resources.zip'
163 input_path.write_text('打印机和鼠标', encoding='utf-8')
164 _write_resource_zip(resource_zip)
165
166 result = subprocess.run(
167 [
168 sys.executable,
169 '-m',
170 'opencc.cli',
171 '-c',
172 's2twp.json',
173 '-i',
174 str(input_path),
175 '-o',
176 str(output_path),
177 '--resource-zip',
178 str(resource_zip),
179 ],
180 capture_output=True,
181 text=True,
182 env=_subprocess_env(),
183 check=False,
184 )
185
186 assert result.returncode == 0, result.stderr
187 assert output_path.read_text(encoding='utf-8') == '印表機和滑鼠'
188
189
190def test_cli_builtin_config_stem_supports_omitting_json(tmp_path, monkeypatch):

Callers

nothing calls this directly

Calls 4

strClass · 0.85
_subprocess_envFunction · 0.85
_write_resource_zipFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected