Skip to content

Commit

Permalink
Merge pull request #1459 from gst/clean__Unittest2CompatMixIn
Browse files Browse the repository at this point in the history
tests: clean Unittest2CompatMixIn: not anymore needed since we use unitt...
  • Loading branch information
gst committed Jan 16, 2015
2 parents 87d64f5 + 6e9382b commit 4d216d9
Showing 1 changed file with 1 addition and 34 deletions.
35 changes: 1 addition & 34 deletions test/shinken_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,41 +176,8 @@ class Pluginconf(object):
pass


class _Unittest2CompatMixIn:
"""
Mixin for simulating methods new in unittest2 resp. Python 2.7.
Every test-case should inherit this *after* unittest.TestCase to
make the compatiblity-methods available if they are not defined in
unittest.TestCase already. Example::
class MyTestCase(unittest.TestCase, Unittest2CompatMixIn):
...
In our case, it's better to always inherit from ShinkenTest
"""
if False:
def assertNotIn(self, member, container, msg=None):
self.assertTrue(member not in container, msg)

def assertIn(self, member, container, msg=None):
self.assertTrue(member in container)

def assertIsInstance(self, obj, cls, msg=None):
self.assertTrue(isinstance(obj, cls))

def assertRegexpMatches(self, line, pattern):
r = re.search(pattern, line)
self.assertTrue(r is not None)

def assertIs(self, obj, cmp, msg=None):
self.assertTrue(obj is cmp, msg or "%r __is not__ %r !" % (obj, cmp))

def assertIsNot(self, obj, cmp, msg=None):
self.assertTrue(obj is not cmp, msg or "%r __is__ %r " % (obj, cmp))


class ShinkenTest(unittest.TestCase, _Unittest2CompatMixIn):
class ShinkenTest(unittest.TestCase):
def setUp(self):
self.setup_with_file('etc/shinken_1r_1h_1s.cfg')

Expand Down

0 comments on commit 4d216d9

Please sign in to comment.