(self, color: bool)
| 2263 | @pytest.mark.incompatible_with_mypyc |
| 2264 | @pytest.mark.parametrize("color", [False, True], ids=["no-color", "with-color"]) |
| 2265 | def test_no_cache_when_writeback_diff(self, color: bool) -> None: |
| 2266 | mode = DEFAULT_MODE |
| 2267 | with cache_dir() as workspace: |
| 2268 | src = (workspace / "test.py").resolve() |
| 2269 | src.write_text("print('hello')", encoding="utf-8") |
| 2270 | with ( |
| 2271 | patch.object(black.Cache, "read") as read_cache, |
| 2272 | patch.object(black.Cache, "write") as write_cache, |
| 2273 | ): |
| 2274 | cmd = [str(src), "--diff"] |
| 2275 | if color: |
| 2276 | cmd.append("--color") |
| 2277 | invokeBlack(cmd) |
| 2278 | cache_file = get_cache_file(mode) |
| 2279 | assert cache_file.exists() is False |
| 2280 | read_cache.assert_called_once() |
| 2281 | write_cache.assert_not_called() |
| 2282 | |
| 2283 | @pytest.mark.parametrize("color", [False, True], ids=["no-color", "with-color"]) |
| 2284 | @event_loop() |
nothing calls this directly
no test coverage detected