Merge lp:~soren/nova/run-pep8-by-default into lp:~hudson-openstack/nova/trunk

Proposed by Soren Hansen
Status: Merged
Approved by: Devin Carlen
Approved revision: 580
Merged at revision: 584
Proposed branch: lp:~soren/nova/run-pep8-by-default
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 118 lines (+39/-38)
2 files modified
run_tests.sh (+30/-30)
setup.py (+9/-8)
To merge this branch: bzr merge lp:~soren/nova/run-pep8-by-default
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Devin Carlen (community) Approve
Review via email: mp+46753@code.launchpad.net

Commit message

Refactor run_tests.sh to allow us to run an extra command after the tests.

Run pep8 after unit tests in run_tests.sh.

Fix setup.py to be PEP-8 compliant.

Description of the change

I'm tired of having to run pep8 manually (or, more accurately, forget to run it altogether and have Hudson reject my patch). This patch adds pep8 to the end of run_tests.sh.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
Jay Pipes (jaypipes) wrote :

lgtm, 2.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'run_tests.sh'
2--- run_tests.sh 2010-12-28 21:43:35 +0000
3+++ run_tests.sh 2011-01-19 10:06:09 +0000
4@@ -31,46 +31,46 @@
5 never_venv=0
6 force=0
7 noseargs=
8-
9+wrapper=""
10
11 for arg in "$@"; do
12 process_option $arg
13 done
14
15+function run_tests {
16+ # Just run the test suites in current environment
17+ ${wrapper} rm -f nova.sqlite
18+ ${wrapper} $NOSETESTS 2> run_tests.err.log
19+}
20+
21 NOSETESTS="python run_tests.py $noseargs"
22
23-if [ $never_venv -eq 1 ]; then
24- # Just run the test suites in current environment
25- rm -f nova.sqlite
26- $NOSETESTS 2> run_tests.err.log
27- exit
28-fi
29-
30-# Remove the virtual environment if --force used
31-if [ $force -eq 1 ]; then
32- echo "Cleaning virtualenv..."
33- rm -rf ${venv}
34-fi
35-
36-if [ -e ${venv} ]; then
37- ${with_venv} rm -f nova.sqlite
38- ${with_venv} $NOSETESTS 2> run_tests.err.log
39-else
40- if [ $always_venv -eq 1 ]; then
41- # Automatically install the virtualenv
42- python tools/install_venv.py
43+if [ $never_venv -eq 0 ]
44+then
45+ # Remove the virtual environment if --force used
46+ if [ $force -eq 1 ]; then
47+ echo "Cleaning virtualenv..."
48+ rm -rf ${venv}
49+ fi
50+ if [ -e ${venv} ]; then
51+ wrapper="${with_venv}"
52 else
53- echo -e "No virtual environment found...create one? (Y/n) \c"
54- read use_ve
55- if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
56- # Install the virtualenv and run the test suite in it
57+ if [ $always_venv -eq 1 ]; then
58+ # Automatically install the virtualenv
59 python tools/install_venv.py
60+ wrapper="${with_venv}"
61 else
62- rm -f nova.sqlite
63- $NOSETESTS 2> run_tests.err.log
64- exit
65+ echo -e "No virtual environment found...create one? (Y/n) \c"
66+ read use_ve
67+ if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
68+ # Install the virtualenv and run the test suite in it
69+ python tools/install_venv.py
70+ wrapper=${with_venv}
71+ fi
72 fi
73 fi
74- ${with_venv} rm -f nova.sqlite
75- ${with_venv} $NOSETESTS 2> run_tests.err.log
76 fi
77+
78+run_tests
79+
80+pep8 --repeat --show-pep8 --show-source bin/* nova setup.py
81
82=== modified file 'setup.py'
83--- setup.py 2011-01-18 19:01:16 +0000
84+++ setup.py 2011-01-19 10:06:09 +0000
85@@ -41,6 +41,7 @@
86 self.finalize_options()
87 BuildDoc.run(self)
88
89+
90 class local_sdist(sdist):
91 """Customized sdist hook - builds the ChangeLog file from VC first"""
92
93@@ -57,17 +58,17 @@
94 changelog_file.write(str_dict_replace(changelog, mailmap))
95 sdist.run(self)
96
97-nova_cmdclass= { 'sdist': local_sdist,
98- 'build_sphinx' : local_BuildDoc }
99+nova_cmdclass = {'sdist': local_sdist,
100+ 'build_sphinx': local_BuildDoc}
101
102 try:
103- from babel.messages import frontend as babel
104- nova_cmdclass['compile_catalog'] = babel.compile_catalog
105- nova_cmdclass['extract_messages'] = babel.extract_messages
106- nova_cmdclass['init_catalog'] = babel.init_catalog
107- nova_cmdclass['update_catalog'] = babel.update_catalog
108+ from babel.messages import frontend as babel
109+ nova_cmdclass['compile_catalog'] = babel.compile_catalog
110+ nova_cmdclass['extract_messages'] = babel.extract_messages
111+ nova_cmdclass['init_catalog'] = babel.init_catalog
112+ nova_cmdclass['update_catalog'] = babel.update_catalog
113 except:
114- pass
115+ pass
116
117 setup(name='nova',
118 version=version.canonical_version_string(),