summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2019-04-14 13:57:48 +0200
committerChristian Heimes <christian@python.org>2019-04-14 13:57:48 +0200
commitc67738d61dabc1a410f7760f23cb5b3108ac4c30 (patch)
tree06a54a8e4ca190014ae568c4ec848a484be6e876
parent0f7037ae2b5304aad2af7c63fdf55d3436664b2c (diff)
downloaddefusedxml-git-c67738d61dabc1a410f7760f23cb5b3108ac4c30.tar.gz
Add black formatter support and checks
Signed-off-by: Christian Heimes <christian@python.org>
-rw-r--r--.travis.yml2
-rw-r--r--Makefile7
-rw-r--r--pyproject.toml3
-rw-r--r--tox.ini9
4 files changed, 18 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml
index 989cff9..e729b8d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,8 @@ matrix:
env: TOXENV=py37
- python: 3.8-dev
env: TOXENV=py38
+ - python: 3.7
+ env: TOXENV=black
- python: 2.7
env: TOXENV=pep8py2
- python: 3.7
diff --git a/Makefile b/Makefile
index c5f6ced..83e5dc8 100644
--- a/Makefile
+++ b/Makefile
@@ -5,9 +5,9 @@ INSTALLFLAGS=
PYTHONS=python2.6 python2.7 python3.1 python3.2 python3.3 python3.4
.PHONY: inplace all rebuild test_inplace test fulltests clean distclean
-.PHONY: sdist install
+.PHONY: sdist install black
-all: inplace README.html README.md
+all: inplace black README.html README.md
README.md: README.txt CHANGES.txt
pandoc --from=rst --to=gfm README.txt > $@
@@ -28,6 +28,9 @@ test_inplace: inplace
test: test_inplace
+black:
+ black $(CURDIR) || true
+
fulltest:
$(MAKE) clean
@set -e; \
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..22e0c45
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,3 @@
+[tool.black]
+line-length = 98
+target-version = ['py27', 'py35', 'py36', 'py37', 'py38']
diff --git a/tox.ini b/tox.ini
index e665374..1920c59 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,5 +1,5 @@
[tox]
-envlist = py27,py35,py36,py37,py38,pep8py2,pep8py3,doc
+envlist = py27,py35,py36,py37,py38,black,pep8py2,pep8py3,doc
skip_missing_interpreters = true
[testenv]
@@ -14,6 +14,13 @@ commands =
# lxml FTBFS because Python sets -Wimplicit-int
deps =
+[testenv:black]
+commands = black --check --verbose \
+ {toxinidir}/setup.py \
+ {toxinidir}/tests.py \
+ {toxinidir}/defusedxml/
+deps = black
+
[testenv:pep8py2]
basepython = python2.7
deps =