MCPcopy Create free account
hub / github.com/psf/black / test_output_locking_when_writeback_diff

Method test_output_locking_when_writeback_diff

tests/test_black.py:2034–2049  ·  view source on GitHub ↗
(self, color: bool)

Source from the content-addressed store, hash-verified

2032 @pytest.mark.parametrize("color", [False, True], ids=["no-color", "with-color"])
2033 @event_loop()
2034 def test_output_locking_when_writeback_diff(self, color: bool) -> None:
2035 with cache_dir() as workspace:
2036 for tag in range(0, 4):
2037 src = (workspace / f"test{tag}.py").resolve()
2038 with src.open("w") as fobj:
2039 fobj.write("print('hello')")
2040 with patch(
2041 "black.concurrency.Manager", wraps=multiprocessing.Manager
2042 ) as mgr:
2043 cmd = ["--diff", str(workspace)]
2044 if color:
2045 cmd.append("--color")
2046 invokeBlack(cmd, exit_code=0)
2047 # this isn't quite doing what we want, but if it _isn't_
2048 # called then we cannot be using the lock it provides
2049 mgr.assert_called()
2050
2051 def test_no_cache_when_stdin(self) -> None:
2052 mode = DEFAULT_MODE

Callers

nothing calls this directly

Calls 3

cache_dirFunction · 0.85
invokeBlackFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected