mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
I've run the black code formatting tool against everything:
black tests datasette setup.py
I also added a new unit test, in tests/test_black.py, which will fail if the code does not
conform to black's exacting standards.
This unit test only runs on Python 3.6 or higher, because black itself doesn't run on 3.5.
20 lines
546 B
Python
20 lines
546 B
Python
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="Black requires Python 3.6 or later"
|
|
)
|
|
def test_black():
|
|
# Do not import at top of module because Python 3.5 will not have it installed
|
|
import black
|
|
|
|
runner = CliRunner()
|
|
result = runner.invoke(
|
|
black.main, [str(code_root / "tests"), str(code_root / "datasette"), "--check"]
|
|
)
|
|
assert result.exit_code == 0, result.output
|