Convert super() calls to py3 style

This commit is contained in:
Deniz Turgut 2019-11-18 20:28:48 +03:00 committed by Kevin Yap
commit 16968834ce
11 changed files with 38 additions and 56 deletions

View file

@ -186,7 +186,7 @@ class LogCountHandler(BufferingHandler):
"""Capturing and counting logged messages."""
def __init__(self, capacity=1000):
super(LogCountHandler, self).__init__(capacity)
super().__init__(capacity)
def count_logs(self, msg=None, level=None):
return len([
@ -202,13 +202,13 @@ class LoggedTestCase(unittest.TestCase):
"""A test case that captures log messages."""
def setUp(self):
super(LoggedTestCase, self).setUp()
super().setUp()
self._logcount_handler = LogCountHandler()
logging.getLogger().addHandler(self._logcount_handler)
def tearDown(self):
logging.getLogger().removeHandler(self._logcount_handler)
super(LoggedTestCase, self).tearDown()
super().tearDown()
def assertLogCountEqual(self, count=None, msg=None, **kwargs):
actual = self._logcount_handler.count_logs(msg=msg, **kwargs)

View file

@ -25,7 +25,7 @@ TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False)
class TestPage(LoggedTestCase):
def setUp(self):
super(TestPage, self).setUp()
super().setUp()
self.old_locale = locale.setlocale(locale.LC_ALL)
locale.setlocale(locale.LC_ALL, str('C'))
self.page_kwargs = {
@ -657,7 +657,7 @@ class TestArticle(TestPage):
class TestStatic(LoggedTestCase):
def setUp(self):
super(TestStatic, self).setUp()
super().setUp()
self.settings = get_settings(
STATIC_SAVE_AS='{path}',
STATIC_URL='{path}',

View file

@ -17,7 +17,7 @@ TEST_SUMMARY = generate_lorem_ipsum(n=1, html=False)
class TestPage(unittest.TestCase):
def setUp(self):
super(TestPage, self).setUp()
super().setUp()
self.old_locale = locale.setlocale(locale.LC_ALL)
locale.setlocale(locale.LC_ALL, str('C'))
self.page_kwargs = {

View file

@ -42,7 +42,7 @@ class TestPelican(LoggedTestCase):
# to run pelican in different situations and see how it behaves
def setUp(self):
super(TestPelican, self).setUp()
super().setUp()
self.temp_path = mkdtemp(prefix='pelicantests.')
self.temp_cache = mkdtemp(prefix='pelican_cache.')
self.maxDiff = None
@ -53,7 +53,7 @@ class TestPelican(LoggedTestCase):
rmtree(self.temp_path)
rmtree(self.temp_cache)
locale.setlocale(locale.LC_ALL, self.old_locale)
super(TestPelican, self).tearDown()
super().tearDown()
def assertDirsEqual(self, left_path, right_path):
out, err = subprocess.Popen(