From e2c129373d4bde20382f91d11e51c75702732a43 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sun, 7 Feb 2021 18:51:57 +0100 Subject: 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 --- sources/shiboken6/tests/minimalbinding/brace_pattern_test.py | 3 ++- sources/shiboken6/tests/minimalbinding/listuser_test.py | 3 ++- sources/shiboken6/tests/minimalbinding/minbool_test.py | 3 ++- sources/shiboken6/tests/minimalbinding/obj_test.py | 3 ++- sources/shiboken6/tests/minimalbinding/typedef_test.py | 3 ++- sources/shiboken6/tests/minimalbinding/val_test.py | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) (limited to 'sources/shiboken6/tests/minimalbinding') diff --git a/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py b/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py index 0d21ab983..842cb93e2 100644 --- a/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py +++ b/sources/shiboken6/tests/minimalbinding/brace_pattern_test.py @@ -42,7 +42,8 @@ import re 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 shiboken_paths import init_paths init_paths() diff --git a/sources/shiboken6/tests/minimalbinding/listuser_test.py b/sources/shiboken6/tests/minimalbinding/listuser_test.py index 3668cb55f..b5048aa44 100644 --- a/sources/shiboken6/tests/minimalbinding/listuser_test.py +++ b/sources/shiboken6/tests/minimalbinding/listuser_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 shiboken_paths import init_paths init_paths() diff --git a/sources/shiboken6/tests/minimalbinding/minbool_test.py b/sources/shiboken6/tests/minimalbinding/minbool_test.py index adc0929fd..789803371 100644 --- a/sources/shiboken6/tests/minimalbinding/minbool_test.py +++ b/sources/shiboken6/tests/minimalbinding/minbool_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 shiboken_paths import init_paths init_paths() diff --git a/sources/shiboken6/tests/minimalbinding/obj_test.py b/sources/shiboken6/tests/minimalbinding/obj_test.py index a0869a67b..1abd6e04c 100644 --- a/sources/shiboken6/tests/minimalbinding/obj_test.py +++ b/sources/shiboken6/tests/minimalbinding/obj_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 shiboken_paths import init_paths init_paths() from minimal import Obj diff --git a/sources/shiboken6/tests/minimalbinding/typedef_test.py b/sources/shiboken6/tests/minimalbinding/typedef_test.py index e8dd5cd16..9076cbe5e 100644 --- a/sources/shiboken6/tests/minimalbinding/typedef_test.py +++ b/sources/shiboken6/tests/minimalbinding/typedef_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 shiboken_paths import init_paths init_paths() from minimal import * diff --git a/sources/shiboken6/tests/minimalbinding/val_test.py b/sources/shiboken6/tests/minimalbinding/val_test.py index f97e9487d..63d2cf300 100644 --- a/sources/shiboken6/tests/minimalbinding/val_test.py +++ b/sources/shiboken6/tests/minimalbinding/val_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 shiboken_paths import init_paths init_paths() from minimal import Val -- cgit v1.2.3