Run codespell in stdin mode and return number of lines in output.
(
text: str,
args: tuple[Any, ...],
cwd: Optional[Path] = None,
)
| 1436 | |
| 1437 | |
| 1438 | def run_codespell_stdin( |
| 1439 | text: str, |
| 1440 | args: tuple[Any, ...], |
| 1441 | cwd: Optional[Path] = None, |
| 1442 | ) -> int: |
| 1443 | """Run codespell in stdin mode and return number of lines in output.""" |
| 1444 | proc = subprocess.run( # noqa: S603 |
| 1445 | ["codespell", *args, "-"], # noqa: S607 |
| 1446 | cwd=cwd, |
| 1447 | input=text, |
| 1448 | capture_output=True, |
| 1449 | encoding="utf-8", |
| 1450 | check=False, |
| 1451 | ) |
| 1452 | output = proc.stdout |
| 1453 | # get number of lines |
| 1454 | return output.count("\n") |
| 1455 | |
| 1456 | |
| 1457 | def test_stdin(tmp_path: Path, capsys: pytest.CaptureFixture[str]) -> None: |
no outgoing calls
no test coverage detected
searching dependent graphs…