Mercurial > hgrepos > Python2 > PyMuPDF
comparison tests/test_flake8.py @ 1:1d09e1dec1d9 upstream
ADD: PyMuPDF v1.26.4: the original sdist.
It does not yet contain MuPDF. This normally will be downloaded when
building PyMuPDF.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:37:51 +0200 |
| parents | |
| children | a6bc019ac0b2 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 1:1d09e1dec1d9 |
|---|---|
| 1 import pymupdf | |
| 2 | |
| 3 import os | |
| 4 import subprocess | |
| 5 import sys | |
| 6 | |
| 7 | |
| 8 def test_flake8(): | |
| 9 ''' | |
| 10 Check rebased Python code with flake8. | |
| 11 ''' | |
| 12 if not hasattr(pymupdf, 'mupdf'): | |
| 13 print(f'Not running flake8 with classic implementation.') | |
| 14 return | |
| 15 ignores = ( | |
| 16 'E123', # closing bracket does not match indentation of opening bracket's line | |
| 17 'E124', # closing bracket does not match visual indentation | |
| 18 'E126', # continuation line over-indented for hanging indent | |
| 19 'E127', # continuation line over-indented for visual indent | |
| 20 'E128', # continuation line under-indented for visual indent | |
| 21 'E131', # continuation line unaligned for hanging indent | |
| 22 'E201', # whitespace after '(' | |
| 23 'E203', # whitespace before ':' | |
| 24 'E221', # E221 multiple spaces before operator | |
| 25 'E225', # missing whitespace around operator | |
| 26 'E226', # missing whitespace around arithmetic operator | |
| 27 'E231', # missing whitespace after ',' | |
| 28 'E241', # multiple spaces after ':' | |
| 29 'E251', # unexpected spaces around keyword / parameter equals | |
| 30 'E252', # missing whitespace around parameter equals | |
| 31 'E261', # at least two spaces before inline comment | |
| 32 'E265', # block comment should start with '# ' | |
| 33 'E271', # multiple spaces after keyword | |
| 34 'E272', # multiple spaces before keyword | |
| 35 'E302', # expected 2 blank lines, found 1 | |
| 36 'E305', # expected 2 blank lines after class or function definition, found 1 | |
| 37 'E306', # expected 1 blank line before a nested definition, found 0 | |
| 38 'E402', # module level import not at top of file | |
| 39 'E501', # line too long (80 > 79 characters) | |
| 40 'E701', # multiple statements on one line (colon) | |
| 41 'E741', # ambiguous variable name 'l' | |
| 42 'F541', # f-string is missing placeholders | |
| 43 'W293', # blank line contains whitespace | |
| 44 'W503', # line break before binary operator | |
| 45 'W504', # line break after binary operator | |
| 46 'E731', # do not assign a lambda expression, use a def | |
| 47 ) | |
| 48 ignores = ','.join(ignores) | |
| 49 root = os.path.abspath(f'{__file__}/../..') | |
| 50 def run(command): | |
| 51 print(f'test_flake8(): Running: {command}') | |
| 52 subprocess.run(command, shell=1, check=1) | |
| 53 run(f'flake8 --ignore={ignores} --statistics {root}/src/__init__.py {root}/src/utils.py {root}/src/table.py') | |
| 54 print(f'test_flake8(): flake8 succeeded.') |
