Merge ~chad.smith/cloud-init:cleanup/test-failures-print-testname into cloud-init:master

Proposed by Chad Smith
Status: Merged
Approved by: Scott Moser
Approved revision: 461a98bd8f358ca01412ed2e1347b350087e4c03
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~chad.smith/cloud-init:cleanup/test-failures-print-testname
Merge into: cloud-init:master
Diff against target: 22 lines (+4/-0)
1 file modified
cloudinit/tests/helpers.py (+4/-0)
Reviewer Review Type Date Requested Status
Scott Moser Approve
Server Team CI bot continuous-integration Approve
Review via email: mp+354273@code.launchpad.net

Commit message

tests: print failed testname instead of docstring upon failure

Description of the change

to validate:

Add a failed assertion to some test and run tox -e py27 tests/unittests/test_log.py with and without this merge proposal.
See the docstring of the test on master and the failed test name test_logger_uses_gmtime

diff --git a/tests/unittests/test_log.py b/tests/unittests/test_log.py
index cd6296d..6802ab5 100644
--- a/tests/unittests/test_log.py
+++ b/tests/unittests/test_log.py
@@ -29,6 +29,7 @@ class TestCloudInitLogger(CiTestCase):

     def test_logger_uses_gmtime(self):
         """Test that log message have timestamp in UTC (gmtime)"""
+ assert 0

         # Log a message, extract the timestamp from the log entry
         # convert to datetime, and compare to a utc timestamp before

To post a comment you must log in.
Revision history for this message
Ryan Harper (raharper) wrote :

That looks nifty, what does that look like in practice?

Revision history for this message
Ryan Harper (raharper) wrote :

Is the file line number available as well?

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:461a98bd8f358ca01412ed2e1347b350087e4c03
https://jenkins.ubuntu.com/server/job/cloud-init-ci/287/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/287/rebuild

review: Approve (continuous-integration)
Revision history for this message
Scott Moser (smoser) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index de24e25..f53ab8f 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -14,6 +14,7 @@ import time
14import mock14import mock
15import six15import six
16import unittest216import unittest2
17from unittest2.util import strclass
1718
18try:19try:
19 from contextlib import ExitStack20 from contextlib import ExitStack
@@ -115,6 +116,9 @@ class TestCase(unittest2.TestCase):
115 super(TestCase, self).setUp()116 super(TestCase, self).setUp()
116 self.reset_global_state()117 self.reset_global_state()
117118
119 def shortDescription(self):
120 return strclass(self.__class__) + '.' + self._testMethodName
121
118 def add_patch(self, target, attr, *args, **kwargs):122 def add_patch(self, target, attr, *args, **kwargs):
119 """Patches specified target object and sets it as attr on test123 """Patches specified target object and sets it as attr on test
120 instance also schedules cleanup"""124 instance also schedules cleanup"""

Subscribers

People subscribed via source and target branches