Fix pep8 tox environment

Changes to tox and the pep8 package require updates to the tox
environment definition.

Change-Id: Id95ae5fe17f71e15903e646f3065db85282359ba
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2018-09-15 10:48:49 -05:00
parent 6d52e41e38
commit b0dad97c33
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
4 changed files with 32 additions and 14 deletions

View File

@ -15,12 +15,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import simplejson as json
import os
import sys
import time
from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment
from jinja2 import FileSystemLoader
from launchpadlib.launchpad import Launchpad
import simplejson as json
def create_files(templatepath, outputpath, projects):
@ -146,23 +148,23 @@ def update_stats(outputpath, project_name, rotation, daily=False):
if __name__ == '__main__':
if len(sys.argv) < 2:
print >> sys.stderr, "No directory supplied"
print("No directory supplied", file=sys.stderr)
basepath = os.path.dirname(sys.argv[0])
configpath = os.path.join(basepath, "config.js")
templatepath = os.path.join(basepath, "templates")
outputpath = sys.argv[1]
if not os.path.isdir(outputpath):
print >> sys.stderr, '%s is not a directory' % outputpath
print('%s is not a directory' % outputpath, file=sys.stderr)
sys.exit(1)
if not os.path.isfile(configpath):
print >> sys.stderr, '%s does not contain config.js' % basepath
print('%s does not contain config.js' % basepath, file=sys.stderr)
sys.exit(1)
cachedir = os.path.expanduser("~/.launchpadlib/cache/")
if not os.path.exists(cachedir):
os.makedirs(cachedir, 0700)
os.makedirs(cachedir, 0o0700)
with open(configpath, 'r') as configfile:
config = json.load(configfile)

View File

@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
from setuptools import setup
setup(

5
test-requirements.txt Normal file
View File

@ -0,0 +1,5 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
hacking>=4.0.0,<4.1.0 # Apache-2.0
flake8-logging-format>=0.6.0 # Apache-2.0

26
tox.ini
View File

@ -1,13 +1,25 @@
[tox]
envlist = pyflakes, pep8, py27
minversion = 3.18.0
skipsdist = True
envlist = pep8,py27
[testenv]
install_command = pip install --allow-external lazr.authentication --allow-insecure lazr.authentication -U {opts} {packages}
basepython = python3
usedevelop = True
install_command=python -m pip install -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages}
[testenv:pyflakes]
deps = pyflakes
commands = pyflakes bugdaystats.py
deps = -r{toxinidir}/test-requirements.txt
[testenv:pep8]
deps = pep8==1.3.3
commands = pep8 --ignore=E125 --repeat --show-source --exclude=.tox .
commands =
flake8 {posargs} .
[flake8]
# The following checks are ignored on purpose.
#
# E125 unexpected spaces around keyword/parameter equals
# reason: no improvement in readability
ignore = E251
exclude = .git,.venv,.tox,dist,tools,doc/ext,*egg,build
max-complexity = 30
import-order-style = pep8