Use flake8 under Tox and fix complaints

This commit is contained in:
Luke Murphy 2019-07-28 22:05:59 +02:00
parent 1f10529209
commit dfd0868510
No known key found for this signature in database
GPG key ID: 5E2EF5A63E3718CC
8 changed files with 34 additions and 12 deletions

View file

@ -1,7 +1,14 @@
language: python language: python
install: pip install tox pep8
python: matrix:
- 2.7 include:
- python: 2.7
env: TOXENV=py27
- python: 2.7
env: TOXENV=lint
install:
- pip install tox
script: script:
- pep8 moulinette
- tox - tox

View file

@ -55,3 +55,11 @@ Requirements
* python-gnupg (>= 0.3) * python-gnupg (>= 0.3)
* python-ldap (>= 2.4) * python-ldap (>= 2.4)
* PyYAML * PyYAML
Testing
-------
```
$ pip install tox
$ tox
```

View file

@ -11,7 +11,7 @@ from gevent.queue import Queue
from geventwebsocket import WebSocketError from geventwebsocket import WebSocketError
from bottle import run, request, response, Bottle, HTTPResponse from bottle import run, request, response, Bottle, HTTPResponse
from bottle import get, post, install, abort, delete, put from bottle import abort
from moulinette import msignals, m18n, DATA_DIR from moulinette import msignals, m18n, DATA_DIR
from moulinette.core import MoulinetteError, clean_session from moulinette.core import MoulinetteError, clean_session

View file

@ -7,7 +7,6 @@ import locale
import logging import logging
from argparse import SUPPRESS from argparse import SUPPRESS
from collections import OrderedDict from collections import OrderedDict
import time
import pytz import pytz
from datetime import date, datetime from datetime import date, datetime

View file

@ -3,7 +3,7 @@ import logging
# import all constants because other modules try to import them from this # import all constants because other modules try to import them from this
# module because SUCCESS is defined in this module # module because SUCCESS is defined in this module
from logging import (addLevelName, setLoggerClass, Logger, getLogger, NOTSET, from logging import (addLevelName, setLoggerClass, Logger, getLogger, NOTSET, # noqa
DEBUG, INFO, WARNING, ERROR, CRITICAL) DEBUG, INFO, WARNING, ERROR, CRITICAL)

View file

@ -1,2 +1,2 @@
[pep8] [flake8]
ignore = E501,E128,E731 ignore = E501,E128,E731,E722

10
tox.ini
View file

@ -1,5 +1,7 @@
[tox] [tox]
envlist = py27 envlist =
py27
lint
skipdist = True skipdist = True
isolated_build = True isolated_build = True
@ -15,3 +17,9 @@ deps =
requests-mock >= 1.6.0, < 2.0 requests-mock >= 1.6.0, < 2.0
commands = commands =
pytest {posargs} pytest {posargs}
[testenv:lint]
commands = flake8 moulinette test
deps = flake8
skip_install = True
usedevelop = False