Merge lp:~allenap/maas-test/result-to-return into lp:maas-test

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 84
Merged at revision: 84
Proposed branch: lp:~allenap/maas-test/result-to-return
Merge into: lp:maas-test
Diff against target: 36 lines (+8/-2)
2 files modified
maastest/console.py (+2/-1)
maastest/main.py (+6/-1)
To merge this branch: bzr merge lp:~allenap/maas-test/result-to-return
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+197872@code.launchpad.net

Commit message

Ensure that the exit status is set depending on success or failure of the embedded tests.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maastest/console.py'
2--- maastest/console.py 2013-11-26 14:23:10 +0000
3+++ maastest/console.py 2013-12-05 14:03:34 +0000
4@@ -23,9 +23,10 @@
5 """Run the tests found on `testcase`, reporting to the console.
6
7 :type testcase: `unittest.TestCase`
8+ :return: `unittest.TestResult`
9 """
10 loader = utils.CasesLoader()
11 suite = loader.loadTestsFromTestCase(testcase)
12 runner = unittest.TextTestRunner(
13 verbosity=2, descriptions=False, failfast=True)
14- runner.run(suite)
15+ return runner.run(suite)
16
17=== modified file 'maastest/main.py'
18--- maastest/main.py 2013-12-05 12:08:28 +0000
19+++ maastest/main.py 2013-12-05 14:03:34 +0000
20@@ -57,10 +57,15 @@
21 # up when a KeyboardInterrupt exception is raised.
22 # This does miss out on test-level and module-level tearDowns.
23 try:
24- run_console(ConfiguredTestMAAS)
25+ result = run_console(ConfiguredTestMAAS)
26 except KeyboardInterrupt:
27 ConfiguredTestMAAS.tearDownClass()
28 raise
29+ else:
30+ if result.wasSuccessful():
31+ return 0
32+ else:
33+ return 2
34
35
36 if __name__ == '__main__':

Subscribers

People subscribed via source and target branches