Merge ~raharper/curtin:fix/makefile-drop-nosetest-command into curtin:master

Proposed by Ryan Harper
Status: Merged
Approved by: Ryan Harper
Approved revision: 73b719f47a6e04194d49c5a86f0b508dc5efc039
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~raharper/curtin:fix/makefile-drop-nosetest-command
Merge into: curtin:master
Diff against target: 184 lines (+21/-15)
7 files modified
Makefile (+15/-6)
dev/null (+0/-6)
tests/vmtests/__init__.py (+1/-1)
tools/block-discover-to-config (+1/-1)
tools/schema-validate-storage (+1/-0)
tools/vmtest-filter (+2/-1)
tools/vmtest-sync-images (+1/-0)
Reviewer Review Type Date Requested Status
Lucas Albuquerque Medeiros de Moura (community) Approve
James Falcon (community) Approve
Server Team CI bot continuous-integration Approve
curtin developers Pending
Review via email: mp+383563@code.launchpad.net

Commit message

Makefile: make adjustments to call lint/style tools via python module

- Drop nosetest invocation
- Drop tools/run-pyflakes*
- Add pylint targets
- Add pylintopts and target_dirs
- Fix style and lint issues

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
James Falcon (falcojr) wrote :

LGTM

review: Approve
Revision history for this message
Lucas Albuquerque Medeiros de Moura (lamoura) wrote :

LGTM too

review: Approve
Revision history for this message
Ryan Harper (raharper) wrote :

Thanks!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Makefile b/Makefile
2index 827102c..68a3ad3 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -1,6 +1,7 @@
6 TOP := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
7 CWD := $(shell pwd)
8-PYTHON ?= python3
9+PYTHON2 ?= python2
10+PYTHON3 ?= python3
11 COVERAGE ?= 1
12 DEFAULT_COVERAGEOPTS = --with-coverage --cover-erase --cover-branches --cover-package=curtin --cover-inclusive
13 ifeq ($(COVERAGE), 1)
14@@ -9,6 +10,8 @@ endif
15 CURTIN_VMTEST_IMAGE_SYNC ?= False
16 export CURTIN_VMTEST_IMAGE_SYNC
17 noseopts ?= -vv --nologcapture
18+pylintopts ?= --rcfile=pylintrc --errors-only
19+target_dirs ?= curtin tests tools
20
21 build:
22
23@@ -26,16 +29,22 @@ pep8:
24 @$(CWD)/tools/run-pep8
25
26 pyflakes:
27- @$(CWD)/tools/run-pyflakes
28+ $(PYTHON2) -m pyflakes $(target_dirs)
29
30 pyflakes3:
31- @$(CWD)/tools/run-pyflakes3
32+ $(PYTHON3) -m pyflakes $(target_dirs)
33+
34+pylint:
35+ $(PYTHON2) -m pylint $(pylintopts) $(target_dirs)
36+
37+pylint3:
38+ $(PYTHON3) -m pylint $(pylintopts) $(target_dirs)
39
40 unittest2:
41- nosetests $(coverageopts) $(noseopts) tests/unittests
42+ $(PYTHON2) -m nose $(coverageopts) $(noseopts) tests/unittests
43
44 unittest3:
45- nosetests3 $(coverageopts) $(noseopts) tests/unittests
46+ $(PYTHON3) -m nose $(coverageopts) $(noseopts) tests/unittests
47
48 unittest: unittest2 unittest3
49
50@@ -53,7 +62,7 @@ check-doc-deps:
51
52 # By default don't sync images when running all tests.
53 vmtest: schema-validate
54- nosetests3 $(noseopts) tests/vmtests
55+ $(PYTHON3) -m nose $(noseopts) tests/vmtests
56
57 vmtest-deps:
58 @$(CWD)/tools/vmtest-system-setup
59diff --git a/tests/vmtests/__init__.py b/tests/vmtests/__init__.py
60index b93043e..222adcc 100644
61--- a/tests/vmtests/__init__.py
62+++ b/tests/vmtests/__init__.py
63@@ -1943,7 +1943,7 @@ class VMBaseClass(TestCase):
64 '''check if test used storage config'''
65 try:
66 return len(self.get_storage_config()) > 0
67- except FileNotFoundError:
68+ except util.FileMissingError:
69 return False
70
71 @skip_if_flag('expected_failure')
72diff --git a/tools/block-discover-to-config b/tools/block-discover-to-config
73index e77eb07..03c7ba7 100755
74--- a/tools/block-discover-to-config
75+++ b/tools/block-discover-to-config
76@@ -28,7 +28,7 @@ def main():
77 if __name__ == "__main__":
78 try:
79 ret = main()
80- except:
81+ except Exception:
82 traceback.print_exc()
83 pdb.post_mortem()
84 ret = 1
85diff --git a/tools/run-pyflakes b/tools/run-pyflakes
86deleted file mode 100755
87index 86eb3cc..0000000
88--- a/tools/run-pyflakes
89+++ /dev/null
90@@ -1,41 +0,0 @@
91-#!/bin/bash
92-# This file is part of curtin. See LICENSE file for copyright and license info.
93-
94-PYTHON_VERSION=${PYTHON_VERSION:-2}
95-CR="
96-"
97-vmtests=""
98-if [ "$PYTHON_VERSION" = "3" ]; then
99- vmtests="tests/vmtests/"
100-fi
101-pycheck_dirs=(
102- "curtin/"
103- "tests/unittests/"
104- $vmtests
105- "tools/curtin-log-print"
106- "tools/report_webhook_logger"
107- "tools/block-discover-to-config"
108- "tools/curtin-log-print"
109- "tools/noproxy"
110- "tools/remove-vmtest-release"
111- "tools/schema-validate-storage"
112- "tools/ssh-keys-list"
113- "tools/vmtest-filter"
114- "tools/vmtest-sync-images"
115- "tools/webserv"
116- "tools/write-curtin"
117-)
118-
119-set -f
120-if [ $# -eq 0 ]; then
121- files=( "${pycheck_dirs[@]}" )
122-else
123- files=( "$@" )
124-fi
125-
126-cmd=( "python${PYTHON_VERSION}" -m "pyflakes" "${files[@]}" )
127-
128-echo "Running: " "${cmd[@]}" 1>&2
129-exec "${cmd[@]}"
130-
131-# vi: ts=4 expandtab syntax=sh
132diff --git a/tools/run-pyflakes3 b/tools/run-pyflakes3
133deleted file mode 100755
134index 2b12e07..0000000
135--- a/tools/run-pyflakes3
136+++ /dev/null
137@@ -1,6 +0,0 @@
138-#!/bin/sh
139-# This file is part of curtin. See LICENSE file for copyright and license info.
140-
141-PYTHON_VERSION=3 exec "${0%/*}/run-pyflakes" "$@"
142-
143-# vi: ts=4 expandtab syntax=sh
144diff --git a/tools/schema-validate-storage b/tools/schema-validate-storage
145index 771ee5b..e07f860 100755
146--- a/tools/schema-validate-storage
147+++ b/tools/schema-validate-storage
148@@ -20,6 +20,7 @@ def get_configs(conf_input):
149 for f in os.listdir(conf_input)])
150 return [conf_input]
151
152+
153 errors = []
154 for conf in get_configs(conf_input):
155 # validate entire config
156diff --git a/tools/vmtest-filter b/tools/vmtest-filter
157index ae427c3..2d7f0a9 100755
158--- a/tools/vmtest-filter
159+++ b/tools/vmtest-filter
160@@ -56,10 +56,11 @@ def main():
161 for tc in find_testcases_by_attr(**kwargs):
162 print(tc)
163
164+
165 if __name__ == '__main__':
166 try:
167 ret = main()
168- except:
169+ except Exception:
170 traceback.print_exc()
171 pdb.post_mortem()
172 ret = 1
173diff --git a/tools/vmtest-sync-images b/tools/vmtest-sync-images
174index 5ee7f9c..f6b8e1d 100755
175--- a/tools/vmtest-sync-images
176+++ b/tools/vmtest-sync-images
177@@ -22,6 +22,7 @@ from tests.vmtests.helpers import (
178 def _fmt_list_filter(filter_name, matches):
179 return '~'.join((filter_name, '|'.join(matches)))
180
181+
182 if __name__ == '__main__':
183 # Acquire an exclusive lock on IMAGE_DIR. This will prevent jenkins-runner
184 # from running while vmtest-sync-images is working.

Subscribers

People subscribed via source and target branches