Migrate code style to Black

This commit is contained in:
Nick Hall
2023-07-31 14:40:59 +01:00
parent 6cb4380d01
commit 41720c5a7e
1109 changed files with 91319 additions and 67252 deletions

View File

@@ -25,22 +25,25 @@ import logging
import sys
import os
log = logging.getLogger('Gramps.Tests.GrampsLogger')
log = logging.getLogger("Gramps.Tests.GrampsLogger")
import gramps.gen.const as const
const.rootDir = os.path.join(os.path.dirname(__file__), '../../gramps')
sys.path.append(os.path.join(const.rootDir, 'test'))
const.rootDir = os.path.join(os.path.dirname(__file__), "../../gramps")
sys.path.append(os.path.join(const.rootDir, "test"))
try:
from guitest.gtktest import GtkTestCase
TestCaseBase = GtkTestCase
log.info("Using guitest")
except:
TestCaseBase = unittest.TestCase
sys.path.append(const.rootDir)
sys.path.append(os.path.join(const.rootDir, 'GrampsLogger'))
sys.path.append(os.path.join(const.rootDir, "GrampsLogger"))
from gramps.gui.logger import RotateHandler, _errorreportassistant
class ErrorReportAssistantTest(TestCaseBase):
"""Test the ErrorReportAssistant."""
@@ -54,19 +57,20 @@ class ErrorReportAssistantTest(TestCaseBase):
l.addHandler(rh)
l.info("info message")
# Comment this out because there is noone to close the dialogue
# error_detail="Test error"
# ass = _errorreportassistant.ErrorReportAssistant(error_detail=error_detail,
# rotate_handler=rh)
#
# assert ass._error_detail == error_detail
# Comment this out because there is noone to close the dialogue
# error_detail="Test error"
# ass = _errorreportassistant.ErrorReportAssistant(error_detail=error_detail,
# rotate_handler=rh)
#
# assert ass._error_detail == error_detail
l.removeHandler(rh)
def testSuite():
suite = unittest.makeSuite(ErrorReportAssistantTest,'test')
suite = unittest.makeSuite(ErrorReportAssistantTest, "test")
return suite
if __name__ == '__main__':
if __name__ == "__main__":
unittest.TextTestRunner().run(testSuite())

View File

@@ -26,14 +26,16 @@ import sys
from gi.repository import Gtk
import os
log = logging.getLogger('Gramps.Tests.GrampsLogger')
log = logging.getLogger("Gramps.Tests.GrampsLogger")
import gramps.gen.const as const
const.rootDir = os.path.join(os.path.dirname(__file__), '../../gramps')
sys.path.append(os.path.join(const.rootDir, 'test'))
const.rootDir = os.path.join(os.path.dirname(__file__), "../../gramps")
sys.path.append(os.path.join(const.rootDir, "test"))
sys.path.append(const.rootDir)
from gramps.gui.logger import RotateHandler, GtkHandler
class GtkHandlerTest(unittest.TestCase):
"""Test the GtkHandler."""
@@ -56,6 +58,8 @@ class GtkHandlerTest(unittest.TestCase):
l.warn("A warn message")
l.debug("A debug message")
log_message = "Debug message"
# Comment this out because there is noone to close the dialogue
# try:
# wibble
@@ -66,11 +70,10 @@ class GtkHandlerTest(unittest.TestCase):
# Gtk.main_iteration()
def testSuite():
suite = unittest.makeSuite(GtkHandlerTest,'test')
suite = unittest.makeSuite(GtkHandlerTest, "test")
return suite
if __name__ == '__main__':
if __name__ == "__main__":
unittest.TextTestRunner().run(testSuite())