aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/tests/QtGui
diff options
context:
space:
mode:
authorChristian Tismer <[email protected]>2021-02-07 18:51:57 +0100
committerChristian Tismer <[email protected]>2021-02-08 14:21:41 +0100
commite2c129373d4bde20382f91d11e51c75702732a43 (patch)
tree056cfca0341542cba3c6f578429b3c3cced235da /sources/pyside6/tests/QtGui
parent95e3b2c7256c71b274be5f16e216116e5876ee87 (diff)
Switch from os.path to pathlib.Path, systematic test changes
This patch does the systematic changes on all tests. Note that there was a bug in principle: os.path was used without importing os.path This worked through the way how the os module initializes itself, but you always will find the explicit import in the python library. But the problem is going away anyway after the transition to pathlib.Path :) Change-Id: I95144d7f9bb07a38376c3aa428df663f2e64bcb7 Reviewed-by: Cristian Maureira-Fredes <[email protected]>
Diffstat (limited to 'sources/pyside6/tests/QtGui')
-rw-r--r--sources/pyside6/tests/QtGui/bug_1091.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_300_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_367.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_480.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_606.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_617.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_652.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_660.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_716.py5
-rw-r--r--sources/pyside6/tests/QtGui/bug_740.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_743.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_991.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_PYSIDE-344.py3
-rw-r--r--sources/pyside6/tests/QtGui/bug_PYSIDE-41.py3
-rw-r--r--sources/pyside6/tests/QtGui/deepcopy_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/pyside_reload_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_reduce_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qcolor_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qcursor_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qdesktopservices_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qfontmetrics_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qguiapplication_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qicon_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qitemselection_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qkeysequence_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpainter_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpdfwriter_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpixelformat_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpixmap_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpixmapcache_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qpolygonf_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qradialgradient_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qrasterwindow_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qregion_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qstylehints_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocument_functions.py3
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qtextline_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/qtransform_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/repr_test.py3
-rw-r--r--sources/pyside6/tests/QtGui/timed_app_and_patching_test.py3
44 files changed, 89 insertions, 45 deletions
diff --git a/sources/pyside6/tests/QtGui/bug_1091.py b/sources/pyside6/tests/QtGui/bug_1091.py
index 78645589b..22788fea0 100644
--- a/sources/pyside6/tests/QtGui/bug_1091.py
+++ b/sources/pyside6/tests/QtGui/bug_1091.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_300_test.py b/sources/pyside6/tests/QtGui/bug_300_test.py
index 8f734780f..8d944840c 100644
--- a/sources/pyside6/tests/QtGui/bug_300_test.py
+++ b/sources/pyside6/tests/QtGui/bug_300_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_367.py b/sources/pyside6/tests/QtGui/bug_367.py
index 07b229d51..0fd676d8b 100644
--- a/sources/pyside6/tests/QtGui/bug_367.py
+++ b/sources/pyside6/tests/QtGui/bug_367.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_480.py b/sources/pyside6/tests/QtGui/bug_480.py
index bedf1ae07..a7c863ba6 100644
--- a/sources/pyside6/tests/QtGui/bug_480.py
+++ b/sources/pyside6/tests/QtGui/bug_480.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_606.py b/sources/pyside6/tests/QtGui/bug_606.py
index 332798a14..918960612 100644
--- a/sources/pyside6/tests/QtGui/bug_606.py
+++ b/sources/pyside6/tests/QtGui/bug_606.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_617.py b/sources/pyside6/tests/QtGui/bug_617.py
index 3c8786cea..008ab488f 100644
--- a/sources/pyside6/tests/QtGui/bug_617.py
+++ b/sources/pyside6/tests/QtGui/bug_617.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_652.py b/sources/pyside6/tests/QtGui/bug_652.py
index c70055b3b..50aa7e7c7 100644
--- a/sources/pyside6/tests/QtGui/bug_652.py
+++ b/sources/pyside6/tests/QtGui/bug_652.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_660.py b/sources/pyside6/tests/QtGui/bug_660.py
index e625f2981..9fb2cd6db 100644
--- a/sources/pyside6/tests/QtGui/bug_660.py
+++ b/sources/pyside6/tests/QtGui/bug_660.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_716.py b/sources/pyside6/tests/QtGui/bug_716.py
index f49b909fa..cb30ff42e 100644
--- a/sources/pyside6/tests/QtGui/bug_716.py
+++ b/sources/pyside6/tests/QtGui/bug_716.py
@@ -29,8 +29,9 @@
import os
import sys
-sys.path.append(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "util"))
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1] / "util"))
from init_paths import init_test_paths
init_test_paths()
diff --git a/sources/pyside6/tests/QtGui/bug_740.py b/sources/pyside6/tests/QtGui/bug_740.py
index 1d32fe5bd..91aa23c86 100644
--- a/sources/pyside6/tests/QtGui/bug_740.py
+++ b/sources/pyside6/tests/QtGui/bug_740.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_743.py b/sources/pyside6/tests/QtGui/bug_743.py
index ce2664a6e..e74b32ba3 100644
--- a/sources/pyside6/tests/QtGui/bug_743.py
+++ b/sources/pyside6/tests/QtGui/bug_743.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_991.py b/sources/pyside6/tests/QtGui/bug_991.py
index 63a4a5760..4738f4f04 100644
--- a/sources/pyside6/tests/QtGui/bug_991.py
+++ b/sources/pyside6/tests/QtGui/bug_991.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
index 7b571cfe2..ce937c9a9 100644
--- a/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
+++ b/sources/pyside6/tests/QtGui/bug_PYSIDE-344.py
@@ -34,7 +34,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py b/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py
index 46173b171..fff11779d 100644
--- a/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py
+++ b/sources/pyside6/tests/QtGui/bug_PYSIDE-41.py
@@ -34,7 +34,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/deepcopy_test.py b/sources/pyside6/tests/QtGui/deepcopy_test.py
index 8cffe2b3f..e1f0240b0 100644
--- a/sources/pyside6/tests/QtGui/deepcopy_test.py
+++ b/sources/pyside6/tests/QtGui/deepcopy_test.py
@@ -31,7 +31,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
index cc381c20a..2537bc5b2 100644
--- a/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
+++ b/sources/pyside6/tests/QtGui/float_to_int_implicit_conversion_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/pyside_reload_test.py b/sources/pyside6/tests/QtGui/pyside_reload_test.py
index 75994f4e4..87d311596 100644
--- a/sources/pyside6/tests/QtGui/pyside_reload_test.py
+++ b/sources/pyside6/tests/QtGui/pyside_reload_test.py
@@ -33,7 +33,8 @@ import shutil
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
index a508dad50..ce855dba1 100644
--- a/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_reduce_test.py
@@ -31,7 +31,8 @@ import pickle
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qcolor_test.py b/sources/pyside6/tests/QtGui/qcolor_test.py
index aef9c24e0..6eaaa94a9 100644
--- a/sources/pyside6/tests/QtGui/qcolor_test.py
+++ b/sources/pyside6/tests/QtGui/qcolor_test.py
@@ -31,7 +31,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qcursor_test.py b/sources/pyside6/tests/QtGui/qcursor_test.py
index aede84498..fcab714a9 100644
--- a/sources/pyside6/tests/QtGui/qcursor_test.py
+++ b/sources/pyside6/tests/QtGui/qcursor_test.py
@@ -34,7 +34,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
index 9bcb03753..580d962c3 100644
--- a/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
+++ b/sources/pyside6/tests/QtGui/qdatastream_gui_operators_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qdesktopservices_test.py b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
index 089465c6c..fb635e142 100644
--- a/sources/pyside6/tests/QtGui/qdesktopservices_test.py
+++ b/sources/pyside6/tests/QtGui/qdesktopservices_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qfontmetrics_test.py b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
index 3a3520003..44ae75a0d 100644
--- a/sources/pyside6/tests/QtGui/qfontmetrics_test.py
+++ b/sources/pyside6/tests/QtGui/qfontmetrics_test.py
@@ -33,7 +33,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qguiapplication_test.py b/sources/pyside6/tests/QtGui/qguiapplication_test.py
index 68f7b8591..35b9574ea 100644
--- a/sources/pyside6/tests/QtGui/qguiapplication_test.py
+++ b/sources/pyside6/tests/QtGui/qguiapplication_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qicon_test.py b/sources/pyside6/tests/QtGui/qicon_test.py
index cb95d02db..24378b844 100644
--- a/sources/pyside6/tests/QtGui/qicon_test.py
+++ b/sources/pyside6/tests/QtGui/qicon_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qitemselection_test.py b/sources/pyside6/tests/QtGui/qitemselection_test.py
index 5c913fa08..157c1bacb 100644
--- a/sources/pyside6/tests/QtGui/qitemselection_test.py
+++ b/sources/pyside6/tests/QtGui/qitemselection_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qkeysequence_test.py b/sources/pyside6/tests/QtGui/qkeysequence_test.py
index 9c8097415..896447740 100644
--- a/sources/pyside6/tests/QtGui/qkeysequence_test.py
+++ b/sources/pyside6/tests/QtGui/qkeysequence_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpainter_test.py b/sources/pyside6/tests/QtGui/qpainter_test.py
index 05af83d4f..3efb6df8b 100644
--- a/sources/pyside6/tests/QtGui/qpainter_test.py
+++ b/sources/pyside6/tests/QtGui/qpainter_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpdfwriter_test.py b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
index 6e567a48e..a58b9242e 100644
--- a/sources/pyside6/tests/QtGui/qpdfwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qpdfwriter_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpixelformat_test.py b/sources/pyside6/tests/QtGui/qpixelformat_test.py
index d9d98ade3..30241f50d 100644
--- a/sources/pyside6/tests/QtGui/qpixelformat_test.py
+++ b/sources/pyside6/tests/QtGui/qpixelformat_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpixmap_test.py b/sources/pyside6/tests/QtGui/qpixmap_test.py
index aa8ade833..496bed5dc 100644
--- a/sources/pyside6/tests/QtGui/qpixmap_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmap_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpixmapcache_test.py b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
index 19b5c99ee..3b45b1b91 100644
--- a/sources/pyside6/tests/QtGui/qpixmapcache_test.py
+++ b/sources/pyside6/tests/QtGui/qpixmapcache_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qpolygonf_test.py b/sources/pyside6/tests/QtGui/qpolygonf_test.py
index df2586b75..8a888d08a 100644
--- a/sources/pyside6/tests/QtGui/qpolygonf_test.py
+++ b/sources/pyside6/tests/QtGui/qpolygonf_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qradialgradient_test.py b/sources/pyside6/tests/QtGui/qradialgradient_test.py
index 92ed0e91c..61a9fc3ef 100644
--- a/sources/pyside6/tests/QtGui/qradialgradient_test.py
+++ b/sources/pyside6/tests/QtGui/qradialgradient_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qrasterwindow_test.py b/sources/pyside6/tests/QtGui/qrasterwindow_test.py
index 154c85b93..07d81c813 100644
--- a/sources/pyside6/tests/QtGui/qrasterwindow_test.py
+++ b/sources/pyside6/tests/QtGui/qrasterwindow_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qregion_test.py b/sources/pyside6/tests/QtGui/qregion_test.py
index b6614c9c1..bd843e162 100644
--- a/sources/pyside6/tests/QtGui/qregion_test.py
+++ b/sources/pyside6/tests/QtGui/qregion_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qstylehints_test.py b/sources/pyside6/tests/QtGui/qstylehints_test.py
index f1afc8f3f..b7b2e9471 100644
--- a/sources/pyside6/tests/QtGui/qstylehints_test.py
+++ b/sources/pyside6/tests/QtGui/qstylehints_test.py
@@ -32,7 +32,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qtextdocument_functions.py b/sources/pyside6/tests/QtGui/qtextdocument_functions.py
index 45e74c3ec..c001c5da9 100644
--- a/sources/pyside6/tests/QtGui/qtextdocument_functions.py
+++ b/sources/pyside6/tests/QtGui/qtextdocument_functions.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
index 03e0aa3b7..caeb0e7cc 100644
--- a/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocument_undoredo_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
index fdf2385aa..cf3721684 100644
--- a/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
+++ b/sources/pyside6/tests/QtGui/qtextdocumentwriter_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qtextline_test.py b/sources/pyside6/tests/QtGui/qtextline_test.py
index 16e3794ce..58bd48620 100644
--- a/sources/pyside6/tests/QtGui/qtextline_test.py
+++ b/sources/pyside6/tests/QtGui/qtextline_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/qtransform_test.py b/sources/pyside6/tests/QtGui/qtransform_test.py
index c2d3b9b6c..8fcddf3ec 100644
--- a/sources/pyside6/tests/QtGui/qtransform_test.py
+++ b/sources/pyside6/tests/QtGui/qtransform_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/repr_test.py b/sources/pyside6/tests/QtGui/repr_test.py
index d7c4693e5..3b732ce77 100644
--- a/sources/pyside6/tests/QtGui/repr_test.py
+++ b/sources/pyside6/tests/QtGui/repr_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)
diff --git a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
index 8646151b1..1290fed90 100644
--- a/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
+++ b/sources/pyside6/tests/QtGui/timed_app_and_patching_test.py
@@ -30,7 +30,8 @@ import os
import sys
import unittest
-sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+from pathlib import Path
+sys.path.append(os.fspath(Path(__file__).resolve().parents[1]))
from init_paths import init_test_paths
init_test_paths(False)