(
tmp_path: Path,
capsys: pytest.CaptureFixture[str],
)
| 211 | |
| 212 | |
| 213 | def test_bad_glob( |
| 214 | tmp_path: Path, |
| 215 | capsys: pytest.CaptureFixture[str], |
| 216 | ) -> None: |
| 217 | # disregard invalid globs, properly handle escaped globs |
| 218 | g = tmp_path / "glob" |
| 219 | g.mkdir() |
| 220 | fname = g / "[b-a].txt" |
| 221 | fname.write_text("abandonned\n") |
| 222 | assert cs.main(g) == 1 |
| 223 | # bad glob is invalid |
| 224 | result = cs.main("--skip", "[b-a].txt", g, std=True) |
| 225 | assert isinstance(result, tuple) |
| 226 | code, _, stderr = result |
| 227 | if sys.hexversion < 0x030A05F0: # Python < 3.10.5 raises re.error |
| 228 | assert code == EX_USAGE, "invalid glob" |
| 229 | assert "invalid glob" in stderr |
| 230 | else: # Python >= 3.10.5 does not match |
| 231 | assert code == 1 |
| 232 | # properly escaped glob is valid, and matches glob-like file name |
| 233 | assert cs.main("--skip", "[[]b-a[]].txt", g) == 0 |
| 234 | |
| 235 | |
| 236 | @pytest.mark.skipif(sys.platform != "linux", reason="Only supported on Linux") |
nothing calls this directly
no test coverage detected
searching dependent graphs…