Forráskód Böngészése

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

Dan Helfman 6 éve
szülő
commit
1ab44d4201
2 módosított fájl, 15 hozzáadás és 1 törlés
  1. 13 0
      scripts/black
  2. 2 1
      tox.ini

+ 13 - 0
scripts/black

@@ -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

+ 2 - 1
tox.ini

@@ -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]