Merge lp:~dobey/ubuntuone-dev-tools/run-with-flakes into lp:ubuntuone-dev-tools

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 98
Merged at revision: 98
Proposed branch: lp:~dobey/ubuntuone-dev-tools/run-with-flakes
Merge into: lp:ubuntuone-dev-tools
Diff against target: 191 lines (+31/-55)
7 files modified
bin/u1lint (+17/-4)
run-tests (+3/-0)
ubuntuone/devtools/reactors/qt4.py (+1/-1)
ubuntuone/devtools/testcase.py (+0/-38)
ubuntuone/devtools/testcases/dbus.py (+2/-4)
ubuntuone/devtools/testcases/squid.py (+1/-1)
ubuntuone/devtools/tests/test_decorators.py (+7/-7)
To merge this branch: bzr merge lp:~dobey/ubuntuone-dev-tools/run-with-flakes
Reviewer Review Type Date Requested Status
Diego Sarmentero (community) Approve
Michał Karnicki (community) Approve
Review via email: mp+130432@code.launchpad.net

Commit message

Remove deprecated ubuntuone.devtools.testcase module.
Update deprecated module usage to use ubuntuone.devtools.testcases package.
Fix some warnings from pyflakes.
Run u1lint with pyflakes as well as pylint in run-tests.

Description of the change

Running pyflakes with this branch will require the version of pyflakes packaged in ppa:ubuntuone/nightlies currently.

To post a comment you must log in.
Revision history for this message
Michał Karnicki (karni) wrote :

Looks good.

review: Approve
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/u1lint'
2--- bin/u1lint 2012-08-22 15:48:30 +0000
3+++ bin/u1lint 2012-10-18 21:23:20 +0000
4@@ -45,6 +45,13 @@
5
6 SRCDIR = os.environ.get('SRCDIR', os.getcwd())
7
8+# Define a dummy WindowsError class to keep pyflakes happy on !Windows
9+# In the future we should remove this, when pyflakes handles platform-specific
10+# code more correctly by ignoring some warnings while on other platforms.
11+if sys.platform != 'win32':
12+ class WindowsError(OSError):
13+ """Dummy WindowsError wrapper to make pyflakes happy."""
14+
15
16 class InvalidSetupException(Exception):
17 """Raised when the env is not correctly setup."""
18@@ -195,17 +202,23 @@
19 # pylint: disable=W0612
20 for root, dirs, files in os.walk(SRCDIR, topdown=False):
21 for filename in files:
22- filepath = "%s/" % root
23+ filepath = root + os.path.sep
24
25 # Skip files in build/
26- if filepath.startswith("%s/build/" % SRCDIR):
27+ builddir = os.path.join(SRCDIR, 'build') + os.path.sep
28+ if filepath.startswith(builddir):
29 continue
30
31 # Skip protobuf-generated and backup files
32- if filename.endswith("_pb2.py") or filename.endswith("~"):
33+ if (filename.endswith("_pb2.py")
34+ or filename.endswith("~")
35+ or filename.endswith(".bat")
36+ ):
37 continue
38
39- if filename.endswith(".py") or filepath.endswith("bin/"):
40+ if (filename.endswith(".py")
41+ or filepath.endswith("bin" + os.path.sep)
42+ ):
43 pyfiles.append(os.path.join(root, filename))
44
45 pyfiles.sort()
46
47=== modified file 'run-tests'
48--- run-tests 2012-08-27 18:47:56 +0000
49+++ run-tests 2012-10-18 21:23:20 +0000
50@@ -26,6 +26,9 @@
51 $PYTHON bin/u1trial --reactor=twisted -i "test_squid_windows.py" ubuntuone
52 echo "Running style checks..."
53 $PYTHON bin/u1lint
54+# Run with pyflakes as well as pylint
55+USE_PYFLAKES="1" $PYTHON bin/u1lint
56+
57 pep8 --repeat . bin/* --exclude=*.bat,.pc
58 rm -rf _trial_temp
59 rm -rf .coverage
60
61=== modified file 'ubuntuone/devtools/reactors/qt4.py'
62--- ubuntuone/devtools/reactors/qt4.py 2012-03-30 17:44:03 +0000
63+++ ubuntuone/devtools/reactors/qt4.py 2012-10-18 21:23:20 +0000
64@@ -41,7 +41,7 @@
65 # pylint: disable=W0612
66 app = QApplication(sys.argv)
67 # pylint: enable=W0612
68-
69+ assert(app)
70 try:
71 qt4reactor = __import__('qt4reactor', None, None, [''])
72 except ImportError:
73
74=== removed file 'ubuntuone/devtools/testcase.py'
75--- ubuntuone/devtools/testcase.py 2012-03-30 17:44:03 +0000
76+++ ubuntuone/devtools/testcase.py 1970-01-01 00:00:00 +0000
77@@ -1,38 +0,0 @@
78-# -*- coding: utf-8 -*-
79-#
80-# Copyright 2011-2012 Canonical Ltd.
81-#
82-# This program is free software: you can redistribute it and/or modify it
83-# under the terms of the GNU General Public License version 3, as published
84-# by the Free Software Foundation.
85-#
86-# This program is distributed in the hope that it will be useful, but
87-# WITHOUT ANY WARRANTY; without even the implied warranties of
88-# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
89-# PURPOSE. See the GNU General Public License for more details.
90-#
91-# You should have received a copy of the GNU General Public License along
92-# with this program. If not, see <http://www.gnu.org/licenses/>.
93-#
94-# In addition, as a special exception, the copyright holders give
95-# permission to link the code of portions of this program with the
96-# OpenSSL library under certain conditions as described in each
97-# individual source file, and distribute linked combinations
98-# including the two.
99-# You must obey the GNU General Public License in all respects
100-# for all of the code used other than OpenSSL. If you modify
101-# file(s) with this exception, you may extend this exception to your
102-# version of the file(s), but you are not obligated to do so. If you
103-# do not wish to do so, delete this exception statement from your
104-# version. If you delete this exception statement from all source
105-# files in the program, then also delete it here.
106-"""Maintain old API."""
107-
108-import warnings
109-warnings.warn(
110- 'Deprecated import path; use ubuntuone.devtools.testcases'
111- 'instead.', DeprecationWarning, stacklevel=2)
112-
113-# pylint: disable=W0401,W0614
114-from ubuntuone.devtools.testcases import *
115-from ubuntuone.devtools.testcases.dbus import *
116
117=== modified file 'ubuntuone/devtools/testcases/dbus.py'
118--- ubuntuone/devtools/testcases/dbus.py 2012-08-28 21:57:24 +0000
119+++ ubuntuone/devtools/testcases/dbus.py 2012-10-18 21:23:20 +0000
120@@ -34,10 +34,8 @@
121
122 from twisted.internet import defer
123
124-# lint seems not tow work well when we use decorators
125-# pylint:disable=W0611
126-from ubuntuone.devtools.testcase import BaseTestCase, skipIf
127-# pylint:enable=W0611
128+from ubuntuone.devtools.testcases import BaseTestCase, skipIf
129+
130 # DBusRunner for DBusTestCase using tests
131 from ubuntuone.devtools.services.dbus import DBusRunner
132
133
134=== modified file 'ubuntuone/devtools/testcases/squid.py'
135--- ubuntuone/devtools/testcases/squid.py 2012-03-30 17:44:03 +0000
136+++ ubuntuone/devtools/testcases/squid.py 2012-10-18 21:23:20 +0000
137@@ -28,7 +28,7 @@
138 # files in the program, then also delete it here.
139 """Base squid tests cases and test utilities."""
140
141-from ubuntuone.devtools.testcase import BaseTestCase, skipIf
142+from ubuntuone.devtools.testcases import BaseTestCase, skipIf
143 from ubuntuone.devtools.services.squid import (
144 SquidRunner,
145 SquidLaunchError,
146
147=== modified file 'ubuntuone/devtools/tests/test_decorators.py'
148--- ubuntuone/devtools/tests/test_decorators.py 2012-05-07 17:57:05 +0000
149+++ ubuntuone/devtools/tests/test_decorators.py 2012-10-18 21:23:20 +0000
150@@ -35,8 +35,8 @@
151 from twisted.trial.runner import LoggedSuite
152 from twisted.trial.reporter import TestResult
153
154-from ubuntuone.devtools import testcase
155-from ubuntuone.devtools.testcase import BaseTestCase
156+from ubuntuone.devtools import testcases
157+from ubuntuone.devtools.testcases import BaseTestCase
158
159 OTHER_PLATFORM = {
160 "darwin": "win32",
161@@ -53,17 +53,17 @@
162 self.patch(os, "getenv", new_getenv)
163
164 operations_table = (
165- (testcase.skipIf,
166+ (testcases.skipIf,
167 (False, "False condition"),
168 (True, "True condition")),
169- (testcase.skipIfOS,
170+ (testcases.skipIfOS,
171 (OTHER_PLATFORM[sys.platform], "skipIf other platform"),
172 (sys.platform, "skipIf this platform")),
173- (testcase.skipIfNotOS,
174+ (testcases.skipIfNotOS,
175 (sys.platform, "skipIfNot this platform"),
176 (OTHER_PLATFORM[sys.platform],
177 "skipIfNot other platform")),
178- (testcase.skipIfJenkins,
179+ (testcases.skipIfJenkins,
180 (OTHER_PLATFORM[sys.platform],
181 "skipIfJenkins other platform"),
182 (sys.platform, "skipIfJenkins this platform")),)
183@@ -108,7 +108,7 @@
184
185 # Decorate the class.
186 # pylint: disable=C0103
187- Foo = testcase.skipTest("testing")(Foo)
188+ Foo = testcases.skipTest("testing")(Foo)
189 # pylint: enable=C0103
190 record = []
191 result = TestResult()

Subscribers

People subscribed via source and target branches

to all changes: