diff --git a/test/conftest.py b/test/conftest.py index af68477..e05d5dc 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -47,6 +47,12 @@ def flake8_version(): return '6.0.0' +@pytest.fixture(scope='session') +def black_version(): + """Version of black supported""" + return '23.1.0' + + @pytest.fixture(scope='session') def yamllint_version(): """Version of yamllint supported""" diff --git a/test/test_syntax.py b/test/test_syntax.py index 8fae79e..aadafde 100644 --- a/test/test_syntax.py +++ b/test/test_syntax.py @@ -55,6 +55,16 @@ def test_flake8(pytestconfig, runner, flake8_version): assert run.success +def test_black(pytestconfig, runner, black_version): + """Passes black""" + if not pytestconfig.getoption("--force-linters"): + run = runner(command=['black', '--version'], report=False) + if black_version not in run.out: + pytest.skip('Unsupported black version') + run = runner(command=['black', '--check', 'test']) + assert run.success + + def test_yamllint(pytestconfig, runner, yamllint_version): """Passes yamllint""" if not pytestconfig.getoption("--force-linters"):