Skip to content
Snippets Groups Projects
Commit 3c9a98b8 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

Test that the source code satisfies the black code formatter.

parent 21d75462
No related branches found
No related tags found
No related merge requests found
Pipeline #37002 failed
......@@ -13,6 +13,7 @@ Build-Depends:
apktool [!ppc64el !s390x] <!nocheck>,
bash-completion,
binutils-multiarch <!nocheck>,
black <!nocheck>,
caca-utils <!nocheck>,
colord <!nocheck>,
db-util <!nocheck>,
......
......@@ -20,6 +20,9 @@
import os
import glob
import diffoscope
import subprocess
from .utils.tools import skip_unless_tools_exist
BASE_DIR = os.path.dirname(os.path.abspath(diffoscope.__file__))
......@@ -28,3 +31,15 @@ def test_dos_mbr():
for x in glob.iglob(os.path.join(BASE_DIR, '**', '*.py'), recursive=True):
with open(x, 'rb') as f:
assert b'DOS/MBR' not in f.read()
@skip_unless_tools_exist('black')
def test_code_is_black_clean():
output = subprocess.check_output(
('black', '--diff', '.'), stderr=subprocess.PIPE
).decode('utf-8')
# Display diff in "captured stdout call"
print(output)
assert len(output) == 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment