aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2020-02-15 13:54:48 +0100
committerChristian Tismer <tismer@stackless.com>2020-02-19 10:42:23 +0100
commit72582a949051383e5b042d43b5b672e3cfa0abc6 (patch)
tree625cb5f4a122807a46cdc45bfb5c42c216d5ae19
parentaacf426340994dc366d39f4f64b5dc33a600d9a4 (diff)
shiboken: Fix funny Python 2.7 glitches
There are two funny glitches that happen with Python 2.7, only. One was the smartpointer test which only failed because Python 2.7 has no list.clear method. This test could be simplified since the tested object is a true list. The other one appeared after the introduction of the BUILD_DIR variable. Python 2.7 failed the enum_test.py because it now needs an import of shiboken2 to do initialization of the signature module. That is a timing problem that we did not have before we had BUILD_DIR. It makes me curious why this bug could slip through the COIN tests! Change-Id: I9b509e9998ad9f40431a8b148892429c0e865393 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--sources/shiboken2/tests/samplebinding/enum_test.py3
-rw-r--r--sources/shiboken2/tests/smartbinding/smart_pointer_test.py2
2 files changed, 4 insertions, 1 deletions
diff --git a/sources/shiboken2/tests/samplebinding/enum_test.py b/sources/shiboken2/tests/samplebinding/enum_test.py
index c8a3d30f1..0beb72033 100644
--- a/sources/shiboken2/tests/samplebinding/enum_test.py
+++ b/sources/shiboken2/tests/samplebinding/enum_test.py
@@ -39,6 +39,9 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from shiboken_paths import init_paths
init_paths()
+import shiboken2
+# This is needed after the introduction of BUILD_DIR.
+
import sample
from sample import SampleNamespace, ObjectType, Event
from py3kcompat import IS_PY3K, b
diff --git a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
index 94f20c800..6210916d3 100644
--- a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
+++ b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py
@@ -183,7 +183,7 @@ class SmartPointerTests(unittest.TestCase):
self.assertEqual(objCount(), 10)
# clear and delete all objects in the list
- ptrToObjList.clear()
+ del ptrToObjList[:] # Python 2.7 lists have no clear method
self.assertEqual(len(ptrToObjList), 0)
self.assertEqual(objCount(), 1)