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
1diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
2index de24e25..f53ab8f 100644
3--- a/cloudinit/tests/helpers.py
4+++ b/cloudinit/tests/helpers.py
5@@ -14,6 +14,7 @@ import time
6 import mock
7 import six
8 import unittest2
9+from unittest2.util import strclass
10
11 try:
12 from contextlib import ExitStack
13@@ -115,6 +116,9 @@ class TestCase(unittest2.TestCase):
14 super(TestCase, self).setUp()
15 self.reset_global_state()
16
17+ def shortDescription(self):
18+ return strclass(self.__class__) + '.' + self._testMethodName
19+
20 def add_patch(self, target, attr, *args, **kwargs):
21 """Patches specified target object and sets it as attr on test
22 instance also schedules cleanup"""

Subscribers

People subscribed via source and target branches