[Asterisk-code-review] Added Debug Message for Test Objects Configured as Base Type (testsuite[master])

Kevin Harwell asteriskteam at digium.com
Tue Dec 8 16:55:17 CST 2015


Kevin Harwell has posted comments on this change.

Change subject: Added Debug Message for Test Objects Configured as Base Type
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/1775/1/lib/python/asterisk/test_runner.py
File lib/python/asterisk/test_runner.py:

Line 323:     from test_case import TestCase
        : 
        :     if type(test_object) == TestCase:
        :         LOGGER.debug(
        :             "**Possible Test Misconfiguration: The test has been configured "
        :             "to instantiate a type of 'test_case.TestCase' as its "
        :             "test-object; however, this type is the base type for the Python "
        :             "tests and not a pluggable module. Did you mean to use "
        :             "'test_case.TestCaseModule?'")
I'm not a huge fan of this. I think at the very least a comment in the TestCase docstring itself would be sufficient. 

Basically, TestCase is an abstract base class or should be treated as such. Barring just adding a comment I think there are better ways to solve this problem. For instance:

First, I believe python now has a way to define a class as an abstract base class (abc module?). Second, another way is to put the check in the constructor to make sure the type being created is not the base class. A third option, which I like better than the second, is to have any method that is required to be implemented by a child class throw an exception from the base class.

Just a few thoughts. What do you think?


-- 
To view, visit https://gerrit.asterisk.org/1775
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I8a16d2f43ae5944680ba393f39bdb80f5df79e07
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list