diff --git a/qutebrowser/test/__init__.py b/qutebrowser/test/__init__.py index 8c1a54b99..793f6e0d2 100644 --- a/qutebrowser/test/__init__.py +++ b/qutebrowser/test/__init__.py @@ -24,3 +24,4 @@ from PyQt5.QtWidgets import QApplication # We create a singleton QApplication here. qApp = QApplication([]) +qApp.setApplicationName('qutebrowser') diff --git a/qutebrowser/test/utils/test_standarddir.py b/qutebrowser/test/utils/test_standarddir.py index 5e717c672..0ccd73b87 100644 --- a/qutebrowser/test/utils/test_standarddir.py +++ b/qutebrowser/test/utils/test_standarddir.py @@ -26,10 +26,10 @@ import shutil import unittest import tempfile -from PyQt5.QtCore import QStandardPaths, QCoreApplication +from PyQt5.QtCore import QStandardPaths from qutebrowser.utils import standarddir -from qutebrowser.test import helpers +from qutebrowser.test import helpers, qApp class GetStandardDirLinuxTests(unittest.TestCase): @@ -38,13 +38,13 @@ class GetStandardDirLinuxTests(unittest.TestCase): Attributes: temp_dir: A temporary directory. - app: The QCoreApplication used. + old_name: The old applicationName. """ def setUp(self): self.temp_dir = tempfile.mkdtemp() - self.app = QCoreApplication([]) - self.app.setApplicationName('qutebrowser') + self.old_name = qApp.applicationName() + qApp.setApplicationName('qutebrowser') @unittest.skipUnless(sys.platform.startswith("linux"), "requires Linux") def test_data_explicit(self): @@ -99,7 +99,7 @@ class GetStandardDirLinuxTests(unittest.TestCase): 'qutebrowser')) def tearDown(self): - self.app.quit() + qApp.setApplicationName(self.old_name) shutil.rmtree(self.temp_dir) @@ -108,13 +108,16 @@ class GetStandardDirWindowsTests(unittest.TestCase): """Tests for standarddir.get under Windows. Attributes: - app: The QCoreApplication used. + old_name: The old applicationName. """ def setUp(self): - self.app = QCoreApplication([]) + self.old_name = qApp.applicationName() # We can't store the files in a temp dir, so we don't chose qutebrowser - self.app.setApplicationName('qutebrowser_test') + qApp.setApplicationName('qutebrowser_test') + + def tearDown(self): + qApp.setApplicationName(self.old_name) @unittest.skipUnless(sys.platform.startswith("win"), "requires Windows") def test_data(self):