Merge lp:~dobey/ubuntuone-dev-tools/trial-args into lp:ubuntuone-dev-tools
- trial-args
- Merge into trunk
Proposed by
dobey
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Roberto Alsina | ||||
Approved revision: | 51 | ||||
Merged at revision: | 48 | ||||
Proposed branch: | lp:~dobey/ubuntuone-dev-tools/trial-args | ||||
Merge into: | lp:ubuntuone-dev-tools | ||||
Diff against target: |
399 lines (+149/-90) 6 files modified
bin/u1lint (+2/-2) bin/u1trial (+140/-84) run-tests (+3/-2) ubuntuone/devtools/reactors/glib.py (+1/-1) ubuntuone/devtools/reactors/qt4.py (+1/-1) ubuntuone/devtools/services/tests/test_dbus.py (+2/-0) |
||||
To merge this branch: | bzr merge lp:~dobey/ubuntuone-dev-tools/trial-args | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roberto Alsina (community) | Approve | ||
Sidnei da Silva (community) | Approve | ||
Review via email:
|
Commit message
Use the Options handling API of trial so unhandled options get passed through
Fix some style issues
Make test_dbus work with --loop argument
Description of the change
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) wrote : | # |
On Mon, 2011-11-21 at 19:37 +0000, Sidnei da Silva wrote:
> 2. Does help-reactors need to be overriden? Seems like trial already implements it.
Typo fixed. And yes, we need to override it, as we support some reactors
which are not installed in the twisted directory, as well as needing to
do some additional work on top of just importing them, for running some
tests that poke at the UI. I would be very happy to not have to
implement the reactor bits here, but for now we have to. :)
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 2011-11-10 20:32:35 +0000 | |||
3 | +++ bin/u1lint 2011-11-21 20:08:24 +0000 | |||
4 | @@ -4,7 +4,7 @@ | |||
5 | 4 | # | 4 | # |
6 | 5 | # Author: Rodney Dawes <rodney.dawes@canonical.com> | 5 | # Author: Rodney Dawes <rodney.dawes@canonical.com> |
7 | 6 | # | 6 | # |
9 | 7 | # Copyright 2009-2010 Canonical Ltd. | 7 | # Copyright 2009-2011 Canonical Ltd. |
10 | 8 | # | 8 | # |
11 | 9 | # This program is free software: you can redistribute it and/or modify it | 9 | # This program is free software: you can redistribute it and/or modify it |
12 | 10 | # under the terms of the GNU General Public License version 3, as published | 10 | # under the terms of the GNU General Public License version 3, as published |
13 | @@ -209,7 +209,7 @@ | |||
14 | 209 | else: | 209 | else: |
15 | 210 | pylint_args = get_subprocess_start_info('pylint') | 210 | pylint_args = get_subprocess_start_info('pylint') |
16 | 211 | # append the extra args to the start info | 211 | # append the extra args to the start info |
18 | 212 | pylint_args.extend(['--output-format=parseable', | 212 | pylint_args.extend(['--output-format=parseable', |
19 | 213 | '--include-ids=yes']) | 213 | '--include-ids=yes']) |
20 | 214 | if PYLINTRC: | 214 | if PYLINTRC: |
21 | 215 | pylint_args.append("--rcfile=" + PYLINTRC) | 215 | pylint_args.append("--rcfile=" + PYLINTRC) |
22 | 216 | 216 | ||
23 | === modified file 'bin/u1trial' | |||
24 | --- bin/u1trial 2011-10-24 15:55:17 +0000 | |||
25 | +++ bin/u1trial 2011-11-21 20:08:24 +0000 | |||
26 | @@ -4,7 +4,7 @@ | |||
27 | 4 | # | 4 | # |
28 | 5 | # Author: Rodney Dawes <rodney.dawes@canonical.com> | 5 | # Author: Rodney Dawes <rodney.dawes@canonical.com> |
29 | 6 | # | 6 | # |
31 | 7 | # Copyright 2009-2010 Canonical Ltd. | 7 | # Copyright 2009-2011 Canonical Ltd. |
32 | 8 | # | 8 | # |
33 | 9 | # This program is free software: you can redistribute it and/or modify it | 9 | # This program is free software: you can redistribute it and/or modify it |
34 | 10 | # under the terms of the GNU General Public License version 3, as published | 10 | # under the terms of the GNU General Public License version 3, as published |
35 | @@ -28,12 +28,15 @@ | |||
36 | 28 | import sys | 28 | import sys |
37 | 29 | import unittest | 29 | import unittest |
38 | 30 | 30 | ||
39 | 31 | from twisted.python.usage import UsageError | ||
40 | 32 | from twisted.scripts import trial | ||
41 | 31 | from twisted.trial.runner import TrialRunner | 33 | from twisted.trial.runner import TrialRunner |
42 | 32 | 34 | ||
43 | 33 | sys.path.insert(0, os.path.abspath(".")) | 35 | sys.path.insert(0, os.path.abspath(".")) |
44 | 34 | 36 | ||
45 | 35 | from ubuntuone.devtools.testing.txcheck import TXCheckSuite | 37 | from ubuntuone.devtools.testing.txcheck import TXCheckSuite |
46 | 36 | 38 | ||
47 | 39 | |||
48 | 37 | def _is_in_ignored_path(testcase, paths): | 40 | def _is_in_ignored_path(testcase, paths): |
49 | 38 | """Return if the testcase is in one of the ignored paths.""" | 41 | """Return if the testcase is in one of the ignored paths.""" |
50 | 39 | for ignored_path in paths: | 42 | for ignored_path in paths: |
51 | @@ -45,12 +48,10 @@ | |||
52 | 45 | class TestRunner(TrialRunner): | 48 | class TestRunner(TrialRunner): |
53 | 46 | """The test runner implementation.""" | 49 | """The test runner implementation.""" |
54 | 47 | 50 | ||
58 | 48 | def __init__(self, force_gc=False): | 51 | def __init__(self, config=None): |
56 | 49 | from twisted.trial.reporter import TreeReporter | ||
57 | 50 | |||
59 | 51 | # set $HOME to the _trial_temp dir, to avoid breaking user files | 52 | # set $HOME to the _trial_temp dir, to avoid breaking user files |
60 | 52 | trial_temp_dir = os.environ.get('TRIAL_TEMP_DIR', os.getcwd()) | 53 | trial_temp_dir = os.environ.get('TRIAL_TEMP_DIR', os.getcwd()) |
62 | 53 | homedir = os.path.join(trial_temp_dir, '_trial_temp') | 54 | homedir = os.path.join(trial_temp_dir, config['temp-directory']) |
63 | 54 | os.environ['HOME'] = homedir | 55 | os.environ['HOME'] = homedir |
64 | 55 | 56 | ||
65 | 56 | # setup $XDG_*_HOME variables and create the directories | 57 | # setup $XDG_*_HOME variables and create the directories |
66 | @@ -71,12 +72,29 @@ | |||
67 | 71 | # setup the ROOTDIR env var | 72 | # setup the ROOTDIR env var |
68 | 72 | os.environ['ROOTDIR'] = os.getcwd() | 73 | os.environ['ROOTDIR'] = os.getcwd() |
69 | 73 | 74 | ||
70 | 75 | # Need an attribute for tempdir so we can use it later | ||
71 | 74 | self.tempdir = homedir | 76 | self.tempdir = homedir |
77 | 75 | working_dir = os.path.join(self.tempdir, 'tmp') | 77 | working_dir = os.path.join(self.tempdir, 'trial') |
78 | 76 | super(TestRunner, self).__init__(reporterFactory=TreeReporter, | 78 | |
79 | 77 | realTimeErrors=True, | 79 | # Handle running trial in debug or dry-run mode |
80 | 78 | workingDirectory=working_dir, | 80 | mode = None |
81 | 79 | forceGarbageCollection=force_gc) | 81 | if config['debug']: |
82 | 82 | mode = TrialRunner.DEBUG | ||
83 | 83 | if config['dry-run']: | ||
84 | 84 | mode = TrialRunner.DRY_RUN | ||
85 | 85 | |||
86 | 86 | # Hook up to the parent test runner | ||
87 | 87 | super(TestRunner, self).__init__( | ||
88 | 88 | reporterFactory=config['reporter'], | ||
89 | 89 | mode=mode, | ||
90 | 90 | profile=config['profile'], | ||
91 | 91 | logfile=config['logfile'], | ||
92 | 92 | tracebackFormat=config['tbformat'], | ||
93 | 93 | realTimeErrors=config['rterrors'], | ||
94 | 94 | uncleanWarnings=config['unclean-warnings'], | ||
95 | 95 | workingDirectory=working_dir, | ||
96 | 96 | forceGarbageCollection=config['force-gc']) | ||
97 | 97 | |||
98 | 80 | self.required_services = [] | 98 | self.required_services = [] |
99 | 81 | self.source_files = [] | 99 | self.source_files = [] |
100 | 82 | 100 | ||
101 | @@ -117,18 +135,6 @@ | |||
102 | 117 | pattern = re.compile('.*%s.*' % test_pattern) | 135 | pattern = re.compile('.*%s.*' % test_pattern) |
103 | 118 | else: | 136 | else: |
104 | 119 | pattern = None | 137 | pattern = None |
105 | 120 | |||
106 | 121 | # get the ignored modules/tests | ||
107 | 122 | if ignored_modules: | ||
108 | 123 | ignored_modules = map(str.strip, ignored_modules.split(',')) | ||
109 | 124 | else: | ||
110 | 125 | ignored_modules = [] | ||
111 | 126 | |||
112 | 127 | # get the ignored paths | ||
113 | 128 | if ignored_paths: | ||
114 | 129 | ignored_paths = map(str.strip, ignored_paths.split(',')) | ||
115 | 130 | else: | ||
116 | 131 | ignored_paths = [] | ||
117 | 132 | 138 | ||
118 | 133 | # Disable this lint warning as we need to access _tests in the | 139 | # Disable this lint warning as we need to access _tests in the |
119 | 134 | # test suites, to collect the tests | 140 | # test suites, to collect the tests |
120 | @@ -169,100 +175,150 @@ | |||
121 | 169 | suite.addTests(module_suite) | 175 | suite.addTests(module_suite) |
122 | 170 | return suite | 176 | return suite |
123 | 171 | 177 | ||
126 | 172 | # pylint: disable=E0202 | 178 | def get_suite(self, config): |
127 | 173 | def run(self, args, options=None): | 179 | """Get the test suite to use.""" |
128 | 180 | suite = unittest.TestSuite() | ||
129 | 181 | for path in config['tests']: | ||
130 | 182 | suite.addTest(self._collect_tests(path, config['test'], | ||
131 | 183 | config['ignore-modules'], | ||
132 | 184 | config['ignore-paths'])) | ||
133 | 185 | if config['loop']: | ||
134 | 186 | old_suite = suite | ||
135 | 187 | suite = unittest.TestSuite() | ||
136 | 188 | for _ in xrange(config['loop']): | ||
137 | 189 | suite.addTest(old_suite) | ||
138 | 190 | |||
139 | 191 | return suite | ||
140 | 192 | |||
141 | 193 | # pylint: disable=C0103 | ||
142 | 194 | def _runWithoutDecoration(self, test): | ||
143 | 174 | """run the tests.""" | 195 | """run the tests.""" |
145 | 175 | success = 0 | 196 | result = None |
146 | 176 | running_services = [] | 197 | running_services = [] |
147 | 177 | if options.coverage: | ||
148 | 178 | coverage.erase() | ||
149 | 179 | coverage.start() | ||
150 | 180 | 198 | ||
151 | 181 | try: | 199 | try: |
152 | 182 | suite = unittest.TestSuite() | ||
153 | 183 | for path in args: | ||
154 | 184 | print "Adding path" | ||
155 | 185 | suite.addTest(self._collect_tests(path, options.test, | ||
156 | 186 | options.ignored_modules, | ||
157 | 187 | options.ignored_paths)) | ||
158 | 188 | if options.loops: | ||
159 | 189 | old_suite = suite | ||
160 | 190 | suite = unittest.TestSuite() | ||
161 | 191 | for _ in xrange(options.loops): | ||
162 | 192 | suite.addTest(old_suite) | ||
163 | 193 | |||
164 | 194 | # Start any required services | 200 | # Start any required services |
165 | 195 | for service in self.required_services: | 201 | for service in self.required_services: |
166 | 196 | runner = service() | 202 | runner = service() |
167 | 197 | runner.start_service(tempdir=self.tempdir) | 203 | runner.start_service(tempdir=self.tempdir) |
168 | 198 | running_services.append(runner) | 204 | running_services.append(runner) |
169 | 199 | 205 | ||
172 | 200 | result = super(TestRunner, self).run(suite) | 206 | result = super(TestRunner, self)._runWithoutDecoration(test) |
171 | 201 | success = result.wasSuccessful() | ||
173 | 202 | finally: | 207 | finally: |
174 | 203 | # Stop all the running services | 208 | # Stop all the running services |
175 | 204 | for runner in running_services: | 209 | for runner in running_services: |
176 | 205 | runner.stop_service() | 210 | runner.stop_service() |
177 | 206 | 211 | ||
187 | 207 | if options.coverage: | 212 | return result |
188 | 208 | coverage.stop() | 213 | |
189 | 209 | coverage.report(self.source_files, ignore_errors=True, | 214 | |
190 | 210 | show_missing=False) | 215 | class Options(trial.Options): |
191 | 211 | 216 | """Class for options handling.""" | |
192 | 212 | if not success: | 217 | |
193 | 213 | sys.exit(1) | 218 | optFlags = [["coverage", "c"], |
194 | 214 | else: | 219 | ["gui", None], |
195 | 215 | sys.exit(0) | 220 | ["help-reactors", None], |
196 | 221 | ] | ||
197 | 222 | |||
198 | 223 | optParameters = [["test", "t", None], | ||
199 | 224 | ["loop", None, 1], | ||
200 | 225 | ["ignore-modules", "i", ""], | ||
201 | 226 | ["ignore-paths", "p", ""], | ||
202 | 227 | ["reactor", "r", "glib"], | ||
203 | 228 | ] | ||
204 | 229 | |||
205 | 230 | def __init__(self): | ||
206 | 231 | self['tests'] = set() | ||
207 | 232 | super(Options, self).__init__() | ||
208 | 233 | self['rterrors'] = True | ||
209 | 234 | |||
210 | 235 | def opt_coverage(self): | ||
211 | 236 | """Generate a coverage report for the run tests""" | ||
212 | 237 | self['coverage'] = True | ||
213 | 238 | |||
214 | 239 | def opt_gui(self): | ||
215 | 240 | """Use the GUI mode of some reactors""" | ||
216 | 241 | self['gui'] = True | ||
217 | 242 | |||
218 | 243 | def opt_help_reactors(self): | ||
219 | 244 | """Help on available reactors for use with tests""" | ||
220 | 245 | synopsis = ('') | ||
221 | 246 | print synopsis | ||
222 | 247 | print 'Need to get list of reactors and print them here.' | ||
223 | 248 | |||
224 | 249 | sys.exit(0) | ||
225 | 250 | |||
226 | 251 | def opt_test(self, option): | ||
227 | 252 | """Run specific tests, e.g: className.methodName""" | ||
228 | 253 | self['test'] = option | ||
229 | 254 | |||
230 | 255 | def opt_loop(self, option): | ||
231 | 256 | """Loop tests the specified number of times.""" | ||
232 | 257 | try: | ||
233 | 258 | self['loop'] = long(option) | ||
234 | 259 | except ValueError: | ||
235 | 260 | raise UsageError('A positive integer value must be specified.') | ||
236 | 261 | |||
237 | 262 | def opt_ignore_modules(self, option): | ||
238 | 263 | """Comma-separate list of test modules to ignore, | ||
239 | 264 | e.g: test_gtk.py, test_account.py | ||
240 | 265 | """ | ||
241 | 266 | self['ignore-modules'] = map(str.strip, option.split(',')) | ||
242 | 267 | |||
243 | 268 | def opt_ignore_paths(self, option): | ||
244 | 269 | """Comma-separated list of relative paths to ignore, | ||
245 | 270 | e.g: tests/platform/windows, tests/platform/macosx | ||
246 | 271 | """ | ||
247 | 272 | self['ignore-paths'] = map(str.strip, option.split(',')) | ||
248 | 273 | |||
249 | 274 | def opt_reactor(self, option): | ||
250 | 275 | """Which reactor to use (see --help-reactors for a list | ||
251 | 276 | of possibilities) | ||
252 | 277 | """ | ||
253 | 278 | self['reactor'] = option | ||
254 | 279 | opt_r = opt_reactor | ||
255 | 216 | 280 | ||
256 | 217 | 281 | ||
257 | 218 | def main(): | 282 | def main(): |
258 | 219 | """Do the deed.""" | 283 | """Do the deed.""" |
289 | 220 | from optparse import OptionParser | 284 | if len(sys.argv) == 1: |
290 | 221 | usage = '%prog [options] path' | 285 | sys.argv.append('--help') |
291 | 222 | parser = OptionParser(usage=usage) | 286 | |
292 | 223 | parser.add_option("-t", "--test", dest="test", | 287 | config = Options() |
293 | 224 | help = "run specific tests, e.g: className.methodName") | 288 | config.parseOptions() |
264 | 225 | parser.add_option("-l", "--loop", dest="loops", type="int", default=1, | ||
265 | 226 | help = "loop selected tests LOOPS number of times", | ||
266 | 227 | metavar="LOOPS") | ||
267 | 228 | parser.add_option("-c", "--coverage", action="store_true", dest="coverage", | ||
268 | 229 | help="print a coverage report when finished") | ||
269 | 230 | parser.add_option("-i", "--ignored-modules", dest="ignored_modules", | ||
270 | 231 | default=None, help="comma-separated test moodules " | ||
271 | 232 | + "to ignore, e.g: test_gtk.py, test_account.py") | ||
272 | 233 | parser.add_option("-p", "--ignore-paths", dest="ignored_paths", | ||
273 | 234 | default=None, help="comma-separated relative " | ||
274 | 235 | + "paths to ignore. " | ||
275 | 236 | + "e.g: tests/platform/windows, tests/platform/macosx") | ||
276 | 237 | parser.add_option("--force-gc", action="store_true", dest="force_gc", | ||
277 | 238 | default=False, help="Run gc.collect() before and after " | ||
278 | 239 | "each test case.") | ||
279 | 240 | parser.add_option("--reactor", type="string", dest="reactor", | ||
280 | 241 | default='glib', | ||
281 | 242 | help="Run the tests using the specified reactor.", | ||
282 | 243 | metavar="REACTOR") | ||
283 | 244 | parser.add_option("--gui", action="store_true", dest="use_gui", | ||
284 | 245 | help="Use the GUI mode of some reactors.") | ||
285 | 246 | (options, args) = parser.parse_args() | ||
286 | 247 | if not args: | ||
287 | 248 | parser.print_help() | ||
288 | 249 | sys.exit(2) | ||
294 | 250 | 289 | ||
295 | 251 | try: | 290 | try: |
297 | 252 | reactor_name = 'ubuntuone.devtools.reactors.%s' % options.reactor | 291 | reactor_name = 'ubuntuone.devtools.reactors.%s' % config['reactor'] |
298 | 253 | reactor = __import__(reactor_name, None, None, ['']) | 292 | reactor = __import__(reactor_name, None, None, ['']) |
299 | 254 | except ImportError: | 293 | except ImportError: |
300 | 255 | print 'The specified reactor is not supported.' | 294 | print 'The specified reactor is not supported.' |
301 | 256 | sys.exit(1) | 295 | sys.exit(1) |
302 | 257 | else: | 296 | else: |
303 | 258 | try: | 297 | try: |
305 | 259 | reactor.install(options=options) | 298 | reactor.install(options=config) |
306 | 260 | except ImportError: | 299 | except ImportError: |
307 | 261 | print('The Python package providing the requested reactor is not ' | 300 | print('The Python package providing the requested reactor is not ' |
308 | 262 | 'installed. You can find it here: %s' % reactor.REACTOR_URL) | 301 | 'installed. You can find it here: %s' % reactor.REACTOR_URL) |
309 | 263 | raise | 302 | raise |
310 | 264 | 303 | ||
312 | 265 | TestRunner(force_gc=options.force_gc).run(args, options) | 304 | trial_runner = TestRunner(config=config) |
313 | 305 | suite = trial_runner.get_suite(config) | ||
314 | 306 | |||
315 | 307 | if config['coverage']: | ||
316 | 308 | coverage.erase() | ||
317 | 309 | coverage.start() | ||
318 | 310 | |||
319 | 311 | if config['until-failure']: | ||
320 | 312 | result = trial_runner.runUntilFailure(suite) | ||
321 | 313 | else: | ||
322 | 314 | result = trial_runner.run(suite) | ||
323 | 315 | |||
324 | 316 | if config['coverage']: | ||
325 | 317 | coverage.stop() | ||
326 | 318 | coverage.report(trial_runner.source_files, ignore_errors=True, | ||
327 | 319 | show_missing=False) | ||
328 | 320 | |||
329 | 321 | sys.exit(not result.wasSuccessful()) | ||
330 | 266 | 322 | ||
331 | 267 | 323 | ||
332 | 268 | if __name__ == '__main__': | 324 | if __name__ == '__main__': |
333 | 269 | 325 | ||
334 | === modified file 'run-tests' | |||
335 | --- run-tests 2011-05-26 15:49:41 +0000 | |||
336 | +++ run-tests 2011-11-21 20:08:24 +0000 | |||
337 | @@ -1,7 +1,7 @@ | |||
338 | 1 | #!/bin/bash | 1 | #!/bin/bash |
339 | 2 | # Author: Natalia Bidart <natalia.bidart@canonical.com> | 2 | # Author: Natalia Bidart <natalia.bidart@canonical.com> |
340 | 3 | # | 3 | # |
342 | 4 | # Copyright 2010 Canonical Ltd. | 4 | # Copyright 2010-2011 Canonical Ltd. |
343 | 5 | # | 5 | # |
344 | 6 | # This program is free software: you can redistribute it and/or modify it | 6 | # This program is free software: you can redistribute it and/or modify it |
345 | 7 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
346 | @@ -18,7 +18,8 @@ | |||
347 | 18 | 18 | ||
348 | 19 | bin/u1trial -c ubuntuone | 19 | bin/u1trial -c ubuntuone |
349 | 20 | bin/u1trial --reactor=twisted ubuntuone | 20 | bin/u1trial --reactor=twisted ubuntuone |
350 | 21 | echo "Running style checks..." | ||
351 | 21 | bin/u1lint | 22 | bin/u1lint |
353 | 22 | pep8 --repeat . | 23 | pep8 --repeat . bin/* |
354 | 23 | rm -rf _trial_temp | 24 | rm -rf _trial_temp |
355 | 24 | rm -rf .coverage | 25 | rm -rf .coverage |
356 | 25 | 26 | ||
357 | === modified file 'ubuntuone/devtools/reactors/glib.py' | |||
358 | --- ubuntuone/devtools/reactors/glib.py 2011-05-26 15:49:41 +0000 | |||
359 | +++ ubuntuone/devtools/reactors/glib.py 2011-11-21 20:08:24 +0000 | |||
360 | @@ -17,7 +17,7 @@ | |||
361 | 17 | def install(options=None): | 17 | def install(options=None): |
362 | 18 | """Install the reactor and parse any options we might need.""" | 18 | """Install the reactor and parse any options we might need.""" |
363 | 19 | reactor_name = None | 19 | reactor_name = None |
365 | 20 | if options is not None and options.use_gui: | 20 | if options is not None and options['gui']: |
366 | 21 | reactor_name = 'twisted.internet.gtk2reactor' | 21 | reactor_name = 'twisted.internet.gtk2reactor' |
367 | 22 | else: | 22 | else: |
368 | 23 | reactor_name = 'twisted.internet.glib2reactor' | 23 | reactor_name = 'twisted.internet.glib2reactor' |
369 | 24 | 24 | ||
370 | === modified file 'ubuntuone/devtools/reactors/qt4.py' | |||
371 | --- ubuntuone/devtools/reactors/qt4.py 2011-11-11 13:31:18 +0000 | |||
372 | +++ ubuntuone/devtools/reactors/qt4.py 2011-11-21 20:08:24 +0000 | |||
373 | @@ -22,7 +22,7 @@ | |||
374 | 22 | 22 | ||
375 | 23 | def install(options=None): | 23 | def install(options=None): |
376 | 24 | """Install the reactor and parse any options we might need.""" | 24 | """Install the reactor and parse any options we might need.""" |
378 | 25 | if options is not None and options.use_gui: | 25 | if options is not None and options['gui']: |
379 | 26 | from PyQt4.QtGui import QApplication | 26 | from PyQt4.QtGui import QApplication |
380 | 27 | # We must assign this to a variable, or we will get crashes in Qt | 27 | # We must assign this to a variable, or we will get crashes in Qt |
381 | 28 | # pylint: disable=W0612 | 28 | # pylint: disable=W0612 |
382 | 29 | 29 | ||
383 | === modified file 'ubuntuone/devtools/services/tests/test_dbus.py' | |||
384 | --- ubuntuone/devtools/services/tests/test_dbus.py 2011-02-03 14:32:01 +0000 | |||
385 | +++ ubuntuone/devtools/services/tests/test_dbus.py 2011-11-21 20:08:24 +0000 | |||
386 | @@ -1,6 +1,7 @@ | |||
387 | 1 | """Tests for the test runner.""" | 1 | """Tests for the test runner.""" |
388 | 2 | 2 | ||
389 | 3 | import os | 3 | import os |
390 | 4 | import shutil | ||
391 | 4 | 5 | ||
392 | 5 | from ubuntuone.devtools.testcase import DBusTestCase | 6 | from ubuntuone.devtools.testcase import DBusTestCase |
393 | 6 | from ubuntuone.devtools.services.dbus import DBusRunner | 7 | from ubuntuone.devtools.services.dbus import DBusRunner |
394 | @@ -25,4 +26,5 @@ | |||
395 | 25 | # pylint: disable=W0212 | 26 | # pylint: disable=W0212 |
396 | 26 | os.makedirs(self.tmpdir) | 27 | os.makedirs(self.tmpdir) |
397 | 27 | runner._find_config_file(tempdir=self.tmpdir) | 28 | runner._find_config_file(tempdir=self.tmpdir) |
398 | 29 | shutil.rmtree(self.tmpdir) | ||
399 | 28 | self.assertEqual(expected, runner.config_file) | 30 | self.assertEqual(expected, runner.config_file) |
1. Typo at 'Need to et list of reactors and print them here.'
2. Does help-reactors need to be overriden? Seems like trial already implements it.
Other than that that, +1!