diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-06 11:14:25 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-06 15:29:32 +0200 |
commit | 04d45f0429c6c6d8eae9c4fcf269ffbcc7d074d8 (patch) | |
tree | 8ad179ccdec7bd45042e15619542b704eac3e867 /sources/pyside6/tests/QtQml/bug_825.py | |
parent | 27bb3f7839d9673b125f8b1b775c4398293932e2 (diff) |
Port tests to pathlib
Replace test helper function adjust_filename() by pathlib
handling. Add asserts on the existence everywhere. Add error
handling with helper functions to QML loading, printing the
error message in the assert statements.
Task-number: PYSIDE-1499
Task-number: PYSIDE-1532
Change-Id: I206929effb37f21d1f621be921bb996162398b4d
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside6/tests/QtQml/bug_825.py')
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_825.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/pyside6/tests/QtQml/bug_825.py b/sources/pyside6/tests/QtQml/bug_825.py index f3315c6ed..039611c70 100644 --- a/sources/pyside6/tests/QtQml/bug_825.py +++ b/sources/pyside6/tests/QtQml/bug_825.py @@ -35,7 +35,7 @@ sys.path.append(os.fspath(Path(__file__).resolve().parents[1])) from init_paths import init_test_paths init_test_paths(False) -from helper.helper import adjust_filename +from helper.helper import quickview_errorstring from PySide6.QtCore import Qt, QUrl, QTimer from PySide6.QtGui import QGuiApplication, QPen @@ -79,7 +79,10 @@ class TestBug825 (unittest.TestCase): self.assertRaises(TypeError, qmlRegisterType, A, 'bugs', 1, 0, 'A') view = QQuickView() - view.setSource(QUrl.fromLocalFile(adjust_filename('bug_825.qml', __file__))) + file = Path(__file__).resolve().parent / 'bug_825.qml' + self.assertTrue(file.is_file()) + view.setSource(QUrl.fromLocalFile(os.fspath(file))) + self.assertTrue(view.rootObject(), quickview_errorstring(view)) view.show() QTimer.singleShot(250, view.close) app.exec_() |