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
=== modified file 'bin/u1lint'
--- bin/u1lint 2012-08-22 15:48:30 +0000
+++ bin/u1lint 2012-10-18 21:23:20 +0000
@@ -45,6 +45,13 @@
4545
46SRCDIR = os.environ.get('SRCDIR', os.getcwd())46SRCDIR = os.environ.get('SRCDIR', os.getcwd())
4747
48# Define a dummy WindowsError class to keep pyflakes happy on !Windows
49# In the future we should remove this, when pyflakes handles platform-specific
50# code more correctly by ignoring some warnings while on other platforms.
51if sys.platform != 'win32':
52 class WindowsError(OSError):
53 """Dummy WindowsError wrapper to make pyflakes happy."""
54
4855
49class InvalidSetupException(Exception):56class InvalidSetupException(Exception):
50 """Raised when the env is not correctly setup."""57 """Raised when the env is not correctly setup."""
@@ -195,17 +202,23 @@
195 # pylint: disable=W0612202 # pylint: disable=W0612
196 for root, dirs, files in os.walk(SRCDIR, topdown=False):203 for root, dirs, files in os.walk(SRCDIR, topdown=False):
197 for filename in files:204 for filename in files:
198 filepath = "%s/" % root205 filepath = root + os.path.sep
199206
200 # Skip files in build/207 # Skip files in build/
201 if filepath.startswith("%s/build/" % SRCDIR):208 builddir = os.path.join(SRCDIR, 'build') + os.path.sep
209 if filepath.startswith(builddir):
202 continue210 continue
203211
204 # Skip protobuf-generated and backup files212 # Skip protobuf-generated and backup files
205 if filename.endswith("_pb2.py") or filename.endswith("~"):213 if (filename.endswith("_pb2.py")
214 or filename.endswith("~")
215 or filename.endswith(".bat")
216 ):
206 continue217 continue
207218
208 if filename.endswith(".py") or filepath.endswith("bin/"):219 if (filename.endswith(".py")
220 or filepath.endswith("bin" + os.path.sep)
221 ):
209 pyfiles.append(os.path.join(root, filename))222 pyfiles.append(os.path.join(root, filename))
210223
211 pyfiles.sort()224 pyfiles.sort()
212225
=== modified file 'run-tests'
--- run-tests 2012-08-27 18:47:56 +0000
+++ run-tests 2012-10-18 21:23:20 +0000
@@ -26,6 +26,9 @@
26$PYTHON bin/u1trial --reactor=twisted -i "test_squid_windows.py" ubuntuone26$PYTHON bin/u1trial --reactor=twisted -i "test_squid_windows.py" ubuntuone
27echo "Running style checks..."27echo "Running style checks..."
28$PYTHON bin/u1lint28$PYTHON bin/u1lint
29# Run with pyflakes as well as pylint
30USE_PYFLAKES="1" $PYTHON bin/u1lint
31
29pep8 --repeat . bin/* --exclude=*.bat,.pc32pep8 --repeat . bin/* --exclude=*.bat,.pc
30rm -rf _trial_temp33rm -rf _trial_temp
31rm -rf .coverage34rm -rf .coverage
3235
=== modified file 'ubuntuone/devtools/reactors/qt4.py'
--- ubuntuone/devtools/reactors/qt4.py 2012-03-30 17:44:03 +0000
+++ ubuntuone/devtools/reactors/qt4.py 2012-10-18 21:23:20 +0000
@@ -41,7 +41,7 @@
41 # pylint: disable=W061241 # pylint: disable=W0612
42 app = QApplication(sys.argv)42 app = QApplication(sys.argv)
43 # pylint: enable=W061243 # pylint: enable=W0612
4444 assert(app)
45 try:45 try:
46 qt4reactor = __import__('qt4reactor', None, None, [''])46 qt4reactor = __import__('qt4reactor', None, None, [''])
47 except ImportError:47 except ImportError:
4848
=== removed file 'ubuntuone/devtools/testcase.py'
--- ubuntuone/devtools/testcase.py 2012-03-30 17:44:03 +0000
+++ ubuntuone/devtools/testcase.py 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1# -*- coding: utf-8 -*-
2#
3# Copyright 2011-2012 Canonical Ltd.
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranties of
11# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
12# PURPOSE. See the GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program. If not, see <http://www.gnu.org/licenses/>.
16#
17# In addition, as a special exception, the copyright holders give
18# permission to link the code of portions of this program with the
19# OpenSSL library under certain conditions as described in each
20# individual source file, and distribute linked combinations
21# including the two.
22# You must obey the GNU General Public License in all respects
23# for all of the code used other than OpenSSL. If you modify
24# file(s) with this exception, you may extend this exception to your
25# version of the file(s), but you are not obligated to do so. If you
26# do not wish to do so, delete this exception statement from your
27# version. If you delete this exception statement from all source
28# files in the program, then also delete it here.
29"""Maintain old API."""
30
31import warnings
32warnings.warn(
33 'Deprecated import path; use ubuntuone.devtools.testcases'
34 'instead.', DeprecationWarning, stacklevel=2)
35
36# pylint: disable=W0401,W0614
37from ubuntuone.devtools.testcases import *
38from ubuntuone.devtools.testcases.dbus import *
390
=== modified file 'ubuntuone/devtools/testcases/dbus.py'
--- ubuntuone/devtools/testcases/dbus.py 2012-08-28 21:57:24 +0000
+++ ubuntuone/devtools/testcases/dbus.py 2012-10-18 21:23:20 +0000
@@ -34,10 +34,8 @@
3434
35from twisted.internet import defer35from twisted.internet import defer
3636
37# lint seems not tow work well when we use decorators37from ubuntuone.devtools.testcases import BaseTestCase, skipIf
38# pylint:disable=W061138
39from ubuntuone.devtools.testcase import BaseTestCase, skipIf
40# pylint:enable=W0611
41# DBusRunner for DBusTestCase using tests39# DBusRunner for DBusTestCase using tests
42from ubuntuone.devtools.services.dbus import DBusRunner40from ubuntuone.devtools.services.dbus import DBusRunner
4341
4442
=== modified file 'ubuntuone/devtools/testcases/squid.py'
--- ubuntuone/devtools/testcases/squid.py 2012-03-30 17:44:03 +0000
+++ ubuntuone/devtools/testcases/squid.py 2012-10-18 21:23:20 +0000
@@ -28,7 +28,7 @@
28# files in the program, then also delete it here.28# files in the program, then also delete it here.
29"""Base squid tests cases and test utilities."""29"""Base squid tests cases and test utilities."""
3030
31from ubuntuone.devtools.testcase import BaseTestCase, skipIf31from ubuntuone.devtools.testcases import BaseTestCase, skipIf
32from ubuntuone.devtools.services.squid import (32from ubuntuone.devtools.services.squid import (
33 SquidRunner,33 SquidRunner,
34 SquidLaunchError,34 SquidLaunchError,
3535
=== modified file 'ubuntuone/devtools/tests/test_decorators.py'
--- ubuntuone/devtools/tests/test_decorators.py 2012-05-07 17:57:05 +0000
+++ ubuntuone/devtools/tests/test_decorators.py 2012-10-18 21:23:20 +0000
@@ -35,8 +35,8 @@
35from twisted.trial.runner import LoggedSuite35from twisted.trial.runner import LoggedSuite
36from twisted.trial.reporter import TestResult36from twisted.trial.reporter import TestResult
3737
38from ubuntuone.devtools import testcase38from ubuntuone.devtools import testcases
39from ubuntuone.devtools.testcase import BaseTestCase39from ubuntuone.devtools.testcases import BaseTestCase
4040
41OTHER_PLATFORM = {41OTHER_PLATFORM = {
42 "darwin": "win32",42 "darwin": "win32",
@@ -53,17 +53,17 @@
53 self.patch(os, "getenv", new_getenv)53 self.patch(os, "getenv", new_getenv)
5454
55 operations_table = (55 operations_table = (
56 (testcase.skipIf,56 (testcases.skipIf,
57 (False, "False condition"),57 (False, "False condition"),
58 (True, "True condition")),58 (True, "True condition")),
59 (testcase.skipIfOS,59 (testcases.skipIfOS,
60 (OTHER_PLATFORM[sys.platform], "skipIf other platform"),60 (OTHER_PLATFORM[sys.platform], "skipIf other platform"),
61 (sys.platform, "skipIf this platform")),61 (sys.platform, "skipIf this platform")),
62 (testcase.skipIfNotOS,62 (testcases.skipIfNotOS,
63 (sys.platform, "skipIfNot this platform"),63 (sys.platform, "skipIfNot this platform"),
64 (OTHER_PLATFORM[sys.platform],64 (OTHER_PLATFORM[sys.platform],
65 "skipIfNot other platform")),65 "skipIfNot other platform")),
66 (testcase.skipIfJenkins,66 (testcases.skipIfJenkins,
67 (OTHER_PLATFORM[sys.platform],67 (OTHER_PLATFORM[sys.platform],
68 "skipIfJenkins other platform"),68 "skipIfJenkins other platform"),
69 (sys.platform, "skipIfJenkins this platform")),)69 (sys.platform, "skipIfJenkins this platform")),)
@@ -108,7 +108,7 @@
108108
109 # Decorate the class.109 # Decorate the class.
110 # pylint: disable=C0103110 # pylint: disable=C0103
111 Foo = testcase.skipTest("testing")(Foo)111 Foo = testcases.skipTest("testing")(Foo)
112 # pylint: enable=C0103112 # pylint: enable=C0103
113 record = []113 record = []
114 result = TestResult()114 result = TestResult()

Subscribers

People subscribed via source and target branches

to all changes: