assert_black_formatted¶
- lsst.ts.salobj.assert_black_formatted(dirpath: Union[str, pathlib.Path]) None ¶
Assert that all Python files in a directory, or any subdirectory of that directory, are formatted with black.
To call this from a unit test (see
tests/test_black.py
):salobj.assert_black_formatted(pathlib.Path(__file__).parents[1])
- Parameters
- dirpath
pathlib.Path
orstr
Path to root directory; typically this will be the root directory of a package, such as ts_salobj.
- dirpath
- Raises
- AssertionError
If any files are not formatted with
black
.
Notes
For this test to exclude
version.py
, list it in.gitignore
asversion.py
, rather than by the full path (e.g. notpython/lsst/ts/salobj/version.py
). This may be a bug in black 19.10b0.