# assert_black_formatted¶

lsst.ts.salobj.assert_black_formatted(dirpath)

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 : Path to root directory; typically this will be the root directory of a package, such as ts_salobj. AssertionError If any files are not formatted with black.

Notes

For this test to exclude version.py, list it in .gitignore as version.py, rather than by the full path (e.g. not python/lsst/ts/salobj/version.py). This may be a bug in black 19.10b0.