Wrap black with script that skips it if Python version < 3.6.

This commit is contained in:
Dan Helfman 2018-10-15 09:20:35 -07:00
parent 71b1c3dfb0
commit 1ab44d4201
2 changed files with 15 additions and 1 deletions

13
scripts/black Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -e
python_version=$(python --version)
if [[ "$python_version" =~ "Python 3.5." ]]; then
echo "Skipping black due to lack of support for $python_version."
elif [[ "$python_version" =~ "Python 3.4." ]]; then
echo "Skipping black due to lack of support for $python_version."
else
black --skip-string-normalization --line-length 100 --check .
fi

View File

@ -5,10 +5,11 @@ skipsdist = True
[testenv] [testenv]
usedevelop = True usedevelop = True
deps = -rtest_requirements.txt deps = -rtest_requirements.txt
whitelist_externals = bash
commands = commands =
py.test --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/end-to-end \ py.test --cov-report term-missing:skip-covered --cov=borgmatic --ignore=tests/end-to-end \
tests [] tests []
- black --skip-string-normalization --line-length 100 --check . bash scripts/black
flake8 . flake8 .
[testenv:black] [testenv:black]