Test ignore dictionary functionality.
(
tmp_path: Path,
capsys: pytest.CaptureFixture[str],
)
| 350 | |
| 351 | |
| 352 | def test_ignore_dictionary( |
| 353 | tmp_path: Path, |
| 354 | capsys: pytest.CaptureFixture[str], |
| 355 | ) -> None: |
| 356 | """Test ignore dictionary functionality.""" |
| 357 | bad_name = tmp_path / "bad.txt" |
| 358 | bad_name.write_text( |
| 359 | "1 abandonned 1\n" |
| 360 | "2 abandonned 2\n" |
| 361 | "3 abandonned 3\r\n" |
| 362 | "4 abilty 4\n" |
| 363 | "5 abilty 5\n" |
| 364 | "6 abilty 6\r\n" |
| 365 | "7 ackward 7\n" |
| 366 | "8 ackward 8\n" |
| 367 | "9 ackward 9\r\n" |
| 368 | "abondon\n" |
| 369 | ) |
| 370 | assert cs.main(bad_name) == 10 |
| 371 | fname = tmp_path / "ignore.txt" |
| 372 | fname.write_text("abandonned\nabilty\r\nackward") |
| 373 | assert cs.main("-I", fname, bad_name) == 1 |
| 374 | # missing file in ignore list |
| 375 | fname_missing = tmp_path / "missing.txt" |
| 376 | result = cs.main("-I", fname_missing, bad_name, std=True) |
| 377 | assert isinstance(result, tuple) |
| 378 | code, _, stderr = result |
| 379 | assert code == EX_USAGE |
| 380 | assert "ERROR:" in stderr |
| 381 | # comma-separated list of files |
| 382 | fname_dummy1 = tmp_path / "dummy1.txt" |
| 383 | fname_dummy1.touch() |
| 384 | fname_dummy2 = tmp_path / "dummy2.txt" |
| 385 | fname_dummy2.touch() |
| 386 | assert cs.main("-I", fname_dummy1, "-I", fname, "-I", fname_dummy2, bad_name) == 1 |
| 387 | assert cs.main("-I", f"{fname_dummy1},{fname},{fname_dummy2}", bad_name) == 1 |
| 388 | |
| 389 | |
| 390 | def test_ignore_words_with_cases( |
nothing calls this directly
no test coverage detected
searching dependent graphs…