Merge ~smoser/cloud-init:fix/citest-show-class-in-failures into cloud-init:master

Proposed by Scott Moser on 2017-10-20
Status: Merged
Merged at revision: a51968d50e7cdecabaf255c26386fd82f6640cc3
Proposed branch: ~smoser/cloud-init:fix/citest-show-class-in-failures
Merge into: cloud-init:master
Diff against target: 40 lines (+7/-4)
2 files modified
tests/cloud_tests/testcases/__init__.py (+7/-0)
tests/cloud_tests/testcases/base.py (+0/-4)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve on 2017-10-20
Chad Smith 2017-10-20 Approve on 2017-10-20
Joshua Powers (community) Approve on 2017-10-20
Review via email: mp+332585@code.launchpad.net

Commit Message

citest: show the class actual class name in results.

Tests are currently run by creating a temporary subclass of each class
and then executing it (in get_suites). When running the tests suite
the output would contain the temporary class name. That was less than
useful, and made batch runs almost impossible to identify which
test case had an error.

This change goes from output of:
    FAIL: test_no_warnings_in_log \
        (tests.cloud_tests.testcases.get_suite.<locals>.tmp)
To
    FAIL: test_no_warnings_in_log \
       (tests.cloud_tests.testcases.modules.ntp.TestNtp)

To post a comment you must log in.
Joshua Powers (powersj) wrote :

Awesome, I like it :)

2017-10-20 19:10:12,167 - tests.cloud_tests - DEBUG - verifying test data for modules/write_files
test_b64 (tests.cloud_tests.testcases.modules.write_files.TestWriteFiles)
Test b64 encoded file reads as ascii. ... ok
test_binary (tests.cloud_tests.testcases.modules.write_files.TestWriteFiles)
...

review: Approve

FAILED: Continuous integration, rev:2e3f44882d7d9c67d30a7e0133d1471367a05978
https://jenkins.ubuntu.com/server/job/cloud-init-ci/417/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

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

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/418/
Executed test runs:
    SUCCESS: Checkout
    FAILED: Unit & Style Tests

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

review: Needs Fixing (continuous-integration)
Chad Smith (chad.smith) wrote :

+1! :)

Chad Smith (chad.smith) :
review: Approve

FAILED: Continuous integration, rev:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/419/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    FAILED: MAAS Compatability Testing

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

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:b6f01178eff019eb0d917805c3fc1be1adaff69d
https://jenkins.ubuntu.com/server/job/cloud-init-ci/421/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    FAILED: MAAS Compatability Testing

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

review: Needs Fixing (continuous-integration)

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

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

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/cloud_tests/testcases/__init__.py b/tests/cloud_tests/testcases/__init__.py
2index 47217ce..a29a092 100644
3--- a/tests/cloud_tests/testcases/__init__.py
4+++ b/tests/cloud_tests/testcases/__init__.py
5@@ -5,6 +5,7 @@
6 import importlib
7 import inspect
8 import unittest
9+from unittest.util import strclass
10
11 from tests.cloud_tests import config
12 from tests.cloud_tests.testcases.base import CloudTestCase as base_test
13@@ -37,6 +38,12 @@ def get_suite(test_name, data, conf):
14
15 class tmp(test_class):
16
17+ _realclass = test_class
18+
19+ def __str__(self):
20+ return "%s (%s)" % (self._testMethodName,
21+ strclass(self._realclass))
22+
23 @classmethod
24 def setUpClass(cls):
25 cls.data = data
26diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
27index b2b5b4b..d3586e3 100644
28--- a/tests/cloud_tests/testcases/base.py
29+++ b/tests/cloud_tests/testcases/base.py
30@@ -16,10 +16,6 @@ class CloudTestCase(unittest.TestCase):
31 conf = None
32 _cloud_config = None
33
34- def shortDescription(self):
35- """Prevent nose from using docstrings."""
36- return None
37-
38 @property
39 def cloud_config(self):
40 """Get the cloud-config used by the test."""

Subscribers

People subscribed via source and target branches

to all changes: