Merge lp://qastaging/~cmiller/desktopcouch/test-from-setupdotpy into lp://qastaging/desktopcouch

Proposed by Chad Miller
Status: Merged
Approved by: Chad Miller
Approved revision: not available
Merged at revision: not available
Proposed branch: lp://qastaging/~cmiller/desktopcouch/test-from-setupdotpy
Merge into: lp://qastaging/desktopcouch
Diff against target: 39 lines (+24/-0)
2 files modified
runtests.py (+23/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp://qastaging/~cmiller/desktopcouch/test-from-setupdotpy
Reviewer Review Type Date Requested Status
Nicola Larosa (community) Approve
Ubuntu One hackers Pending
Review via email: mp+14998@code.qastaging.launchpad.net

Commit message

Make tests runnable from setuptools' setup.py 'test' rule.

To post a comment you must log in.
Revision history for this message
Nicola Larosa (teknico) wrote :

Ooh, you're an angel. You make this grumpy old chap's heart melt. ;-) Thank you.

However, since I'm a grumpy old chap, I'll mutter in a low voice that when I run tests with "trail desktopcouch", I get a nice green column of [OK]; it's not there anymore when running "setup.py test", though.

Can you get that back too? :-)

review: Approve
Revision history for this message
Chad Miller (cmiller) wrote :

> When I
> run tests with "trail desktopcouch", I get a nice green column of [OK]; it's
> not there anymore when running "setup.py test", though.
>
> Can you get that back too? :-)

Sorry, no. That's a different test runner. All I provide to setuputils is the test suite.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'runtests.py'
2--- runtests.py 1970-01-01 00:00:00 +0000
3+++ runtests.py 2009-11-18 16:25:22 +0000
4@@ -0,0 +1,23 @@
5+#!/usr/bin/python
6+
7+import os, sys
8+from twisted.trial import runner, itrial, reporter
9+
10+dir, filename = os.path.split(__file__)
11+sys.path.insert(0, os.path.realpath(dir))
12+
13+def get_test_suite():
14+ loader = runner.TestLoader()
15+ return loader.loadByNames(['desktopcouch'], True)
16+
17+def run():
18+ test_runner = runner.TrialRunner(reporter.TreeReporter)
19+ test_result = test_runner.run(get_test_suite())
20+ return test_result.wasSuccessful()
21+
22+if __name__ == '__main__':
23+ import gobject
24+ gobject.set_application_name("desktopcouch test runner")
25+
26+ ret = run()
27+ sys.exit(not ret)
28
29=== modified file 'setup.py'
30--- setup.py 2009-10-22 20:52:56 +0000
31+++ setup.py 2009-11-18 16:25:22 +0000
32@@ -28,6 +28,7 @@
33 license='LGPL-3',
34 author='Stuart Langridge',
35 author_email='stuart.langridge@canonical.com',
36+ test_suite="runtests.get_test_suite",
37 packages=find_packages(),
38 scripts=['bin/desktopcouch-pair'],
39 data_files = [('/usr/lib/desktopcouch/', ['bin/desktopcouch-service',

Subscribers

People subscribed via source and target branches