mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Unit test enforcing black formatting
Only runs for Python 3.6 at the moment. See https://github.com/python/black/issues/425
This commit is contained in:
parent
9e054f5a84
commit
f9193e7a18
2 changed files with 20 additions and 0 deletions
1
setup.py
1
setup.py
|
|
@ -54,6 +54,7 @@ setup(
|
||||||
"pytest-asyncio==0.10.0",
|
"pytest-asyncio==0.10.0",
|
||||||
"aiohttp==3.5.3",
|
"aiohttp==3.5.3",
|
||||||
"beautifulsoup4==4.6.1",
|
"beautifulsoup4==4.6.1",
|
||||||
|
"black",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
tests_require=["datasette[test]"],
|
tests_require=["datasette[test]"],
|
||||||
|
|
|
||||||
19
tests/test_black.py
Normal file
19
tests/test_black.py
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
import black
|
||||||
|
from click.testing import CliRunner
|
||||||
|
from pathlib import Path
|
||||||
|
import pytest
|
||||||
|
import sys
|
||||||
|
|
||||||
|
code_root = Path(__file__).parent.parent
|
||||||
|
|
||||||
|
|
||||||
|
# @pytest.mark.skipif(
|
||||||
|
# sys.version_info[:2] > (3, 6),
|
||||||
|
# reason="Breaks on 3.7 at the moment, but it only needs to run under one Python version",
|
||||||
|
# )
|
||||||
|
def test_black():
|
||||||
|
runner = CliRunner()
|
||||||
|
result = runner.invoke(
|
||||||
|
black.main, [str(code_root / "tests"), str(code_root / "datasette"), "--check"]
|
||||||
|
)
|
||||||
|
assert result.exit_code == 0, result.output
|
||||||
Loading…
Add table
Add a link
Reference in a new issue