Browse Source

Setup a tox pep8 check and update test-requirements.txt

Add a tox pep8 check.
Fix PEP8 error in tools/list_ptls.py

Update test-requirements.txt for libraries used.

Change-Id: I179036ebbce555586a711677f45337b364d4847f
changes/98/319398/1
John L. Villalovos 3 years ago
parent
commit
ffa7d55448
4 changed files with 40 additions and 3 deletions
  1. 3
    0
      test-requirements.txt
  2. 20
    0
      test_tools/flake8wrap.sh
  3. 2
    1
      tools/list_ptls.py
  4. 15
    2
      tox.ini

+ 3
- 0
test-requirements.txt View File

@@ -1 +1,4 @@
1
+hacking<0.11,>=0.10.0
2
+PyYAML>=3.1.0  # MIT
3
+requests>=2.10.0  # Apache-2.0
1 4
 yaml2ical>=0.6.1

+ 20
- 0
test_tools/flake8wrap.sh View File

@@ -0,0 +1,20 @@
1
+#!/bin/bash
2
+#
3
+# A simple wrapper around flake8 which makes it possible
4
+# to ask it to only verify files changed in the current
5
+# git HEAD patch.
6
+#
7
+# Intended to be invoked via tox:
8
+#
9
+#   tox -epep8 -- -HEAD
10
+#
11
+
12
+if test "x$1" = "x-HEAD" ; then
13
+    shift
14
+    files=$(git diff --name-only HEAD~1 | tr '\n' ' ')
15
+    echo "Running flake8 on ${files}"
16
+    diff -u --from-file /dev/null ${files} | flake8 --diff "$@"
17
+else
18
+    echo "Running flake8 on all files"
19
+    exec flake8 "$@"
20
+fi

+ 2
- 1
tools/list_ptls.py View File

@@ -22,6 +22,7 @@ import yaml
22 22
 
23 23
 PROJECTS_LIST = "http://git.openstack.org/cgit/openstack/governance/plain/reference/projects.yaml"  # noqa
24 24
 
25
+
25 26
 def main():
26 27
     parser = argparse.ArgumentParser()
27 28
     parser.add_argument(
@@ -57,7 +58,7 @@ def main():
57 58
                         initial_indent=args.msg + ' ',
58 59
                         subsequent_indent=args.msg + ' ',
59 60
                         width=80,
60
-                    ))
61
+                        ))
61 62
 
62 63
 
63 64
 if __name__ == '__main__':

+ 15
- 2
tox.ini View File

@@ -1,5 +1,5 @@
1 1
 [tox]
2
-envlist = ical
2
+envlist = ical,pep8
3 3
 minversion = 1.6
4 4
 skipsdist = True
5 5
 
@@ -7,12 +7,12 @@ skipsdist = True
7 7
 install_command = pip install -U {opts} {packages}
8 8
 setenv = VIRTUAL_ENV={envdir}
9 9
 deps = -r{toxinidir}/test-requirements.txt
10
-whitelist_externals = mkdir
11 10
 
12 11
 [testenv:venv]
13 12
 commands = {posargs}
14 13
 
15 14
 [testenv:ical]
15
+whitelist_externals = mkdir
16 16
 commands =
17 17
     mkdir -p output/calendars
18 18
     yaml2ical -n "OpenStack Meetings" \
@@ -24,3 +24,16 @@ commands =
24 24
 [testenv:check]
25 25
 commands =
26 26
     python tools/check_channels.py -y meetings
27
+
28
+[testenv:pep8]
29
+whitelist_externals = bash
30
+commands =
31
+  bash test_tools/flake8wrap.sh {posargs}
32
+
33
+[flake8]
34
+ignore =
35
+exclude =  .git,.tox
36
+max-complexity = 14
37
+
38
+[hacking]
39
+import_exceptions =

Loading…
Cancel
Save