Skip to content

Commit e704175

Browse files
Add black to linting
1 parent 1b36bf2 commit e704175

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

test/conftest.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ def flake8_version():
4747
return '6.0.0'
4848

4949

50+
@pytest.fixture(scope='session')
51+
def black_version():
52+
"""Version of black supported"""
53+
return '23.1.0'
54+
55+
5056
@pytest.fixture(scope='session')
5157
def yamllint_version():
5258
"""Version of yamllint supported"""

test/test_syntax.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ def test_flake8(pytestconfig, runner, flake8_version):
5555
assert run.success
5656

5757

58+
def test_black(pytestconfig, runner, black_version):
59+
"""Passes black"""
60+
if not pytestconfig.getoption("--force-linters"):
61+
run = runner(command=['black', '--version'], report=False)
62+
if black_version not in run.out:
63+
pytest.skip('Unsupported black version')
64+
run = runner(command=['black', '--check', 'test'])
65+
assert run.success
66+
67+
5868
def test_yamllint(pytestconfig, runner, yamllint_version):
5969
"""Passes yamllint"""
6070
if not pytestconfig.getoption("--force-linters"):

0 commit comments

Comments
 (0)