Merge lp:~jderose/userwebkit/py3.3 into lp:userwebkit

Proposed by Jason Gerard DeRose
Status: Merged
Merged at revision: 84
Proposed branch: lp:~jderose/userwebkit/py3.3
Merge into: lp:userwebkit
Diff against target: 224 lines (+91/-40)
5 files modified
MANIFEST.in (+1/-1)
debian/control (+10/-10)
setup.py (+8/-24)
userwebkit/__init__.py (+4/-5)
userwebkit/tests/run.py (+68/-0)
To merge this branch: bzr merge lp:~jderose/userwebkit/py3.3
Reviewer Review Type Date Requested Status
Angel Guzman Maeso (community) Approve
Jason Gerard DeRose Approve
Review via email: mp+149750@code.launchpad.net

Description of the change

For details, see this bug:

https://bugs.launchpad.net/userwebkit/+bug/1131052

Changes:

* Move userwebkit.py to userwebkit/__init__.py

* Move test_userwebkit.py to userwebkit/tests/__init__.py

* Added userwebkit.tests.run module, which allows you to run the tests like this:

python3 -m userwebkit.tests.run

* To be consisted with other components, drop Python 3.2 support, require Python 3.3 or newer

To post a comment you must log in.
Revision history for this message
Jason Gerard DeRose (jderose) wrote :

Gotta rush, gonna self-approve this one.

review: Approve
Revision history for this message
Angel Guzman Maeso (shakaran) wrote :

Much more cleaner now. Looks fine for me with only Python 3.3+ support.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'MANIFEST.in'
2--- MANIFEST.in 2011-09-26 10:58:32 +0000
3+++ MANIFEST.in 2013-02-21 06:21:20 +0000
4@@ -1,1 +1,1 @@
5-include COPYING COPYING.LESSER test_userwebkit.py
6+include COPYING COPYING.LESSER
7
8=== modified file 'debian/control'
9--- debian/control 2012-11-15 03:26:59 +0000
10+++ debian/control 2013-02-21 06:21:20 +0000
11@@ -3,23 +3,23 @@
12 Priority: optional
13 Maintainer: Jason Gerard DeRose <jderose@novacut.com>
14 Build-Depends: debhelper (>= 9),
15- python3-all (>= 3.2.3),
16- python3-microfiber (>= 12.11),
17- python3-usercouch (>= 12.11),
18- python3-dbus,
19- python3-gi,
20- gir1.2-gtk-3.0,
21- gir1.2-webkit-3.0,
22+ python3-all (>= 3.3),
23 xvfb,
24+ python3-microfiber (>= 13.02),
25+ python3-usercouch (>= 13.02),
26+ python3-dbus,
27+ python3-gi,
28+ gir1.2-gtk-3.0,
29+ gir1.2-webkit-3.0,
30 Standards-Version: 3.9.3
31-X-Python3-Version: >= 3.2
32+X-Python3-Version: >= 3.3
33 Homepage: https://launchpad.net/userwebkit
34
35 Package: python3-userwebkit
36 Architecture: all
37 Depends: ${python3:Depends}, ${misc:Depends},
38- python3-microfiber (>= 12.11),
39- python3-usercouch (>= 12.11) | dc3 (>= 12.02),
40+ python3-microfiber (>= 13.02),
41+ python3-usercouch (>= 13.02),
42 python3-dbus,
43 python3-gi,
44 gir1.2-gtk-3.0,
45
46=== modified file 'setup.py'
47--- setup.py 2013-01-29 08:33:53 +0000
48+++ setup.py 2013-02-21 06:21:20 +0000
49@@ -26,13 +26,11 @@
50 """
51
52 import sys
53-if sys.version_info < (3, 2):
54- sys.exit('ERROR: UserWebKit requires Python 3.2 or newer')
55+if sys.version_info < (3, 3):
56+ sys.exit('ERROR: UserWebKit requires Python 3.3 or newer')
57
58 from distutils.core import setup
59 from distutils.cmd import Command
60-from unittest import TestLoader, TextTestRunner
61-from doctest import DocTestSuite
62 import os
63 from os import path
64
65@@ -49,21 +47,9 @@
66 pass
67
68 def run(self):
69- pynames = ['userwebkit', 'test_userwebkit']
70-
71- # Add unit-tests:
72- loader = TestLoader()
73- suite = loader.loadTestsFromNames(pynames)
74-
75- # Add doc-tests:
76- for name in pynames:
77- suite.addTest(DocTestSuite(name))
78-
79- # Run the tests:
80- runner = TextTestRunner(verbosity=2)
81- result = runner.run(suite)
82- if not result.wasSuccessful():
83- raise SystemExit(2)
84+ from userwebkit.tests.run import run_tests
85+ if not run_tests():
86+ raise SystemExit('2')
87
88
89 setup(
90@@ -74,14 +60,12 @@
91 author='Jason Gerard DeRose',
92 author_email='jderose@novacut.com',
93 license='LGPLv3+',
94- py_modules=['userwebkit'],
95- cmdclass={
96- 'test': Test,
97- #'build': build_with_docs,
98- },
99+ packages=['userwebkit', 'userwebkit.tests'],
100+ cmdclass={'test': Test},
101 data_files=[
102 ('share/couchdb/apps/userwebkit',
103 [path.join('ui', name) for name in os.listdir('ui')]
104 ),
105 ],
106 )
107+
108
109=== added directory 'userwebkit'
110=== renamed file 'userwebkit.py' => 'userwebkit/__init__.py'
111--- userwebkit.py 2013-01-29 08:33:53 +0000
112+++ userwebkit/__init__.py 2013-02-21 06:21:20 +0000
113@@ -34,8 +34,7 @@
114 from microfiber import _oauth_header, _basic_auth_header
115 import dbus
116 from dbus.mainloop.glib import DBusGMainLoop
117-from gi.repository import GObject, Gtk, WebKit
118-from gi.repository.GObject import TYPE_PYOBJECT
119+from gi.repository import GLib, GObject, Gtk, WebKit
120
121
122 __version__ = '13.02.0'
123@@ -55,7 +54,7 @@
124 class CouchView(WebKit.WebView):
125 __gsignals__ = {
126 'open': (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
127- [TYPE_PYOBJECT]
128+ [GObject.TYPE_PYOBJECT]
129 ),
130 }
131
132@@ -209,7 +208,7 @@
133 assert isinstance(signals, dict)
134 for (name, argnames) in signals.items():
135 assert isinstance(argnames, list)
136- args = [TYPE_PYOBJECT for argname in argnames]
137+ args = [GObject.TYPE_PYOBJECT for argname in argnames]
138 yield (name, (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, args))
139
140
141@@ -327,7 +326,7 @@
142 self.parse()
143 self.build_window()
144 self.window.show_all()
145- GObject.idle_add(self.on_idle)
146+ GLib.idle_add(self.on_idle)
147 Gtk.main()
148
149 def quit(self, *arg):
150
151=== added directory 'userwebkit/tests'
152=== renamed file 'test_userwebkit.py' => 'userwebkit/tests/__init__.py'
153=== added file 'userwebkit/tests/run.py'
154--- userwebkit/tests/run.py 1970-01-01 00:00:00 +0000
155+++ userwebkit/tests/run.py 2013-02-21 06:21:20 +0000
156@@ -0,0 +1,68 @@
157+# userwebkit: so WebKitGtk apps can to talk to a usercouch
158+# Copyright (C) 2013 Novacut Inc
159+#
160+# This file is part of `userwebkit`.
161+#
162+# `userwebkit` is free software: you can redistribute it and/or modify it under
163+# the terms of the GNU Lesser General Public License as published by the Free
164+# Software Foundation, either version 3 of the License, or (at your option) any
165+# later version.
166+#
167+# `userwebkit` is distributed in the hope that it will be useful, but WITHOUT
168+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
169+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
170+# details.
171+#
172+# You should have received a copy of the GNU Lesser General Public License along
173+# with `userwebkit`. If not, see <http://www.gnu.org/licenses/>.
174+#
175+# Authors:
176+# Jason Gerard DeRose <jderose@novacut.com>
177+
178+
179+"""
180+Run the `userwebkit` unit tests.
181+
182+From the command line, run like this::
183+
184+ $ python3 -m userwebkit.tests.run
185+"""
186+
187+import sys
188+from os import path
189+from unittest import TestLoader, TextTestRunner
190+from doctest import DocTestSuite
191+
192+import userwebkit
193+
194+
195+pynames = (
196+ 'userwebkit',
197+ 'userwebkit.tests',
198+)
199+
200+
201+def run_tests():
202+ # Add unit-tests:
203+ loader = TestLoader()
204+ suite = loader.loadTestsFromNames(pynames)
205+
206+ # Add doc-tests:
207+ for name in pynames:
208+ suite.addTest(DocTestSuite(name))
209+
210+ # Run the tests:
211+ runner = TextTestRunner(verbosity=2)
212+ result = runner.run(suite)
213+ success = result.wasSuccessful()
214+ print(
215+ 'userwebkit: {!r}'.format(path.abspath(userwebkit.__file__)),
216+ file=sys.stderr
217+ )
218+ print('-' * 70, file=sys.stderr)
219+ return result.wasSuccessful()
220+
221+
222+if __name__ == '__main__':
223+ if not run_tests():
224+ raise SystemExit('2')

Subscribers

People subscribed via source and target branches