(tmp_path)
| 157 | |
| 158 | |
| 159 | def 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 | |
| 190 | def test_cli_builtin_config_stem_supports_omitting_json(tmp_path, monkeypatch): |
nothing calls this directly
no test coverage detected