Merge lp:~veebers/autopilot/fix_too_many_vids_1189655 into lp:autopilot

Proposed by Christopher Lee
Status: Merged
Approved by: Chris Gagnon
Approved revision: 242
Merged at revision: 241
Proposed branch: lp:~veebers/autopilot/fix_too_many_vids_1189655
Merge into: lp:autopilot
Diff against target: 61 lines (+31/-2)
2 files modified
autopilot/globals.py (+4/-1)
autopilot/tests/functional/test_autopilot_functional.py (+27/-1)
To merge this branch: bzr merge lp:~veebers/autopilot/fix_too_many_vids_1189655
Reviewer Review Type Date Requested Status
Chris Gagnon (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+168590@code.launchpad.net

Commit message

Added an extra check so that a 'failing' test wasn't recorded if it was in fact a skipping test.

Description of the change

Added an extra check so that a 'failing' test wasn't recorded if it was in fact a skipping test.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

Can you add a test for the new if statement?

review: Needs Fixing
242. By Christopher Lee

Added missing test for video recording and skipped tests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Chris Gagnon (chris.gagnon) wrote :

Looks good, thanks for writing the test

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'autopilot/globals.py'
--- autopilot/globals.py 2013-05-30 12:00:24 +0000
+++ autopilot/globals.py 2013-06-12 00:43:25 +0000
@@ -163,7 +163,10 @@
163163
164 def _on_test_failed(self, ex_info):164 def _on_test_failed(self, ex_info):
165 """Called when a test fails."""165 """Called when a test fails."""
166 self._test_passed = False166 from unittest.case import SkipTest
167 failure_class_type = ex_info[0]
168 if failure_class_type is not SkipTest:
169 self._test_passed = False
167170
168171
169_video_logger = _VideoLogger()172_video_logger = _VideoLogger()
170173
=== modified file 'autopilot/tests/functional/test_autopilot_functional.py'
--- autopilot/tests/functional/test_autopilot_functional.py 2013-05-30 21:35:13 +0000
+++ autopilot/tests/functional/test_autopilot_functional.py 2013-06-12 00:43:25 +0000
@@ -466,7 +466,7 @@
466 if should_delete:466 if should_delete:
467 self.addCleanup(remove_if_exists, ap_dir)467 self.addCleanup(remove_if_exists, ap_dir)
468 else:468 else:
469 self.addCleanup(remove_if_exists, 469 self.addCleanup(remove_if_exists,
470 '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir))470 '%s/tests.test_simple.SimpleTest.test_simple.ogv' % (ap_dir))
471471
472 code, output, error = self.run_autopilot(["run", "-r", "-rd", video_dir, "tests"])472 code, output, error = self.run_autopilot(["run", "-r", "-rd", video_dir, "tests"])
@@ -526,6 +526,32 @@
526 self.assertFalse(os.path.exists(526 self.assertFalse(os.path.exists(
527 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))527 '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'))
528528
529 def test_no_videos_saved_for_skipped_test(self):
530 """Videos must not be saved if the test has been skipped (not
531 failed).
532
533 """
534 self.create_test_file("test_simple.py", dedent("""\
535
536 from autopilot.testcase import AutopilotTestCase
537 from time import sleep
538
539 class SimpleTest(AutopilotTestCase):
540
541 def test_simple(self):
542 sleep(1)
543 self.skip("Skipping Test")
544 """
545 ))
546
547 video_file_path = '/tmp/autopilot/tests.test_simple.SimpleTest.test_simple.ogv'
548 self.addCleanup(remove_if_exists, video_file_path)
549
550 code, output, error = self.run_autopilot(["run", "-r", "tests"])
551
552 self.assertThat(code, Equals(0))
553 self.assertThat(os.path.exists(video_file_path), Equals(False))
554
529 def test_runs_with_import_errors_fail(self):555 def test_runs_with_import_errors_fail(self):
530 """Import errors inside a test must be considered a test failure."""556 """Import errors inside a test must be considered a test failure."""
531 self.create_test_file('test_simple.py', dedent("""\557 self.create_test_file('test_simple.py', dedent("""\

Subscribers

People subscribed via source and target branches