From 21b8ce263ad8990daed8ad2d4d79e6e0cf9e3c10 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 11 Feb 2020 08:35:50 +0100 Subject: Fix running the shiboken tests for Python 3.8/Windows On Windows, DLL directories can no longer be specified via the PATH environment variable. They need to be added via os.add_dll_directory(). In order to fix this, move the entire environment setup from CMake to a python helper and set a single environment variable BUILD_DIR pointing to the build directory from CMake. In addition, this has a huge advantage: The tests can also be executed much more easily without ctest from the command line by just setting BUILD_DIR instead of a complex manipulation of PATH/LD_LIBRARY_PATH. Change-Id: I7dceafd2c38fed5320a534322f265489657b95d3 Reviewed-by: Cristian Maureira-Fredes --- sources/shiboken2/tests/CMakeLists.txt | 18 ++---- .../tests/minimalbinding/brace_pattern_test.py | 8 ++- .../tests/minimalbinding/listuser_test.py | 7 ++ .../shiboken2/tests/minimalbinding/minbool_test.py | 6 ++ sources/shiboken2/tests/minimalbinding/obj_test.py | 6 ++ .../shiboken2/tests/minimalbinding/typedef_test.py | 6 ++ sources/shiboken2/tests/minimalbinding/val_test.py | 6 ++ .../collector_external_operator_test.py | 6 ++ ..._for_class_without_implicit_conversions_test.py | 6 ++ .../extended_multiply_operator_test.py | 6 ++ .../tests/otherbinding/module_reload_test.py | 6 +- .../tests/otherbinding/new_ctor_operator_test.py | 6 ++ .../tests/otherbinding/objtypehashes_test.py | 6 ++ .../tests/otherbinding/otherderived_test.py | 5 ++ .../tests/otherbinding/typediscovery_test.py | 6 ++ .../usersprimitivefromothermodule_test.py | 6 ++ .../shiboken2/tests/otherbinding/wrongctor_test.py | 6 ++ .../shiboken2/tests/samplebinding/__del___test.py | 7 ++ .../shiboken2/tests/samplebinding/abstract_test.py | 5 ++ .../tests/samplebinding/addedfunction_test.py | 6 ++ .../addedfunction_with_container_args_test.py | 6 ++ .../samplebinding/argumentmodifications_test.py | 5 ++ .../tests/samplebinding/array_numpy_test.py | 6 ++ .../tests/samplebinding/array_sequence_test.py | 6 ++ .../shiboken2/tests/samplebinding/bug_554_test.py | 6 ++ .../shiboken2/tests/samplebinding/bug_704_test.py | 6 ++ .../tests/samplebinding/bytearray_test.py | 6 ++ .../tests/samplebinding/child_return_test.py | 5 ++ .../tests/samplebinding/class_fields_test.py | 6 ++ .../tests/samplebinding/collector_test.py | 5 ++ .../shiboken2/tests/samplebinding/complex_test.py | 5 ++ .../samplebinding/conversion_operator_test.py | 6 ++ sources/shiboken2/tests/samplebinding/copy_test.py | 6 ++ .../tests/samplebinding/ctorconvrule_test.py | 6 ++ .../shiboken2/tests/samplebinding/cyclic_test.py | 6 ++ sources/shiboken2/tests/samplebinding/date_test.py | 5 ++ .../shiboken2/tests/samplebinding/decisor_test.py | 6 ++ .../shiboken2/tests/samplebinding/delete_test.py | 6 ++ .../tests/samplebinding/deprecated_test.py | 8 ++- .../shiboken2/tests/samplebinding/derived_test.py | 5 ++ .../tests/samplebinding/duck_punching_test.py | 6 ++ sources/shiboken2/tests/samplebinding/echo_test.py | 6 ++ sources/shiboken2/tests/samplebinding/enum_test.py | 4 ++ .../samplebinding/enumfromremovednamespace_test.py | 6 ++ .../samplebinding/event_loop_call_virtual_test.py | 6 ++ .../tests/samplebinding/event_loop_thread_test.py | 8 ++- .../tests/samplebinding/exception_test.py | 6 ++ .../shiboken2/tests/samplebinding/filter_test.py | 6 ++ .../tests/samplebinding/handleholder_test.py | 6 ++ .../tests/samplebinding/hashabletype_test.py | 6 ++ .../tests/samplebinding/ignorederefop_test.py | 6 ++ .../samplebinding/implicitconv_numerical_test.py | 6 ++ .../tests/samplebinding/implicitconv_test.py | 6 ++ .../samplebinding/inheritanceandscope_test.py | 6 ++ .../tests/samplebinding/injectcode_test.py | 6 ++ .../tests/samplebinding/innerclass_test.py | 6 ++ .../shiboken2/tests/samplebinding/intlist_test.py | 6 ++ .../samplebinding/invalid_virtual_return_test.py | 6 ++ .../tests/samplebinding/keep_reference_test.py | 8 ++- sources/shiboken2/tests/samplebinding/list_test.py | 6 ++ sources/shiboken2/tests/samplebinding/lock_test.py | 8 ++- sources/shiboken2/tests/samplebinding/map_test.py | 6 ++ .../tests/samplebinding/metaclass_test.py | 9 ++- .../tests/samplebinding/mi_virtual_methods_test.py | 6 ++ .../shiboken2/tests/samplebinding/mixed_mi_test.py | 6 ++ .../tests/samplebinding/modelindex_test.py | 6 ++ .../tests/samplebinding/modelview_test.py | 6 ++ .../tests/samplebinding/modifications_test.py | 6 ++ .../samplebinding/modified_constructor_test.py | 6 ++ .../samplebinding/modifiedvirtualmethods_test.py | 6 ++ .../samplebinding/multi_cpp_inheritance_test.py | 5 ++ .../tests/samplebinding/multiple_derived_test.py | 5 ++ .../tests/samplebinding/namespace_test.py | 7 ++ .../tests/samplebinding/newdivision_test.py | 10 ++- .../tests/samplebinding/nondefaultctor_test.py | 5 ++ .../tests/samplebinding/nontypetemplate_test.py | 6 ++ .../shiboken2/tests/samplebinding/nonzero_test.py | 7 ++ .../tests/samplebinding/numericaltypedef_test.py | 6 ++ .../shiboken2/tests/samplebinding/numpy_test.py | 6 ++ .../tests/samplebinding/objecttype_test.py | 6 ++ .../objecttype_with_named_args_test.py | 6 ++ .../tests/samplebinding/objecttypebyvalue_test.py | 10 ++- .../tests/samplebinding/objecttypelayout_test.py | 5 ++ .../samplebinding/objecttypeoperators_test.py | 6 ++ ...ecttypereferenceasvirtualmethodargument_test.py | 6 ++ .../shiboken2/tests/samplebinding/oddbool_test.py | 6 ++ .../samplebinding/oldstyleclass_as_number_test.py | 7 ++ .../tests/samplebinding/onlycopyclass_test.py | 7 ++ .../shiboken2/tests/samplebinding/overflow_test.py | 5 ++ .../tests/samplebinding/overload_sorting_test.py | 6 ++ .../shiboken2/tests/samplebinding/overload_test.py | 6 ++ .../samplebinding/overloadwithdefault_test.py | 6 ++ .../ownership_argument_invalidation_test.py | 5 ++ .../ownership_delete_child_in_cpp_test.py | 6 ++ .../ownership_delete_child_in_python_test.py | 8 ++- .../samplebinding/ownership_delete_parent_test.py | 5 ++ .../ownership_invalidate_after_use_test.py | 5 ++ .../ownership_invalidate_child_test.py | 6 ++ .../ownership_invalidate_nonpolymorphic_test.py | 5 ++ .../ownership_invalidate_parent_test.py | 6 ++ .../samplebinding/ownership_reparenting_test.py | 6 ++ .../samplebinding/ownership_transference_test.py | 5 ++ sources/shiboken2/tests/samplebinding/pair_test.py | 5 ++ sources/shiboken2/tests/samplebinding/pen_test.py | 6 ++ .../shiboken2/tests/samplebinding/point_test.py | 5 ++ .../tests/samplebinding/pointerholder_test.py | 5 ++ .../samplebinding/pointerprimitivetype_test.py | 6 ++ .../shiboken2/tests/samplebinding/pointf_test.py | 6 ++ .../primitivereferenceargument_test.py | 6 ++ .../tests/samplebinding/privatector_test.py | 5 ++ .../tests/samplebinding/privatedtor_test.py | 5 ++ .../tests/samplebinding/protected_test.py | 6 ++ .../shiboken2/tests/samplebinding/pstrlist_test.py | 6 ++ .../shiboken2/tests/samplebinding/pystr_test.py | 5 ++ .../tests/samplebinding/python_thread_test.py | 14 ++-- .../samplebinding/receive_null_cstring_test.py | 6 ++ .../tests/samplebinding/reference_test.py | 5 ++ .../tests/samplebinding/referencetopointer_test.py | 6 ++ .../tests/samplebinding/return_null_test.py | 5 ++ .../tests/samplebinding/richcompare_test.py | 6 ++ .../shiboken2/tests/samplebinding/sample_test.py | 6 ++ .../tests/samplebinding/simplefile_test.py | 5 ++ sources/shiboken2/tests/samplebinding/size_test.py | 6 ++ .../samplebinding/static_nonstatic_methods_test.py | 5 ++ sources/shiboken2/tests/samplebinding/str_test.py | 6 ++ .../shiboken2/tests/samplebinding/strlist_test.py | 6 ++ .../samplebinding/templateinheritingclass_test.py | 7 ++ sources/shiboken2/tests/samplebinding/time_test.py | 6 ++ .../tests/samplebinding/transform_test.py | 6 ++ .../tests/samplebinding/typeconverters_test.py | 7 ++ .../tests/samplebinding/typedealloc_test.py | 8 ++- .../tests/samplebinding/typedtordoublefree_test.py | 6 ++ .../tests/samplebinding/unsafe_parent_test.py | 5 ++ .../tests/samplebinding/useraddedctor_test.py | 6 ++ .../tests/samplebinding/virtualdtor_test.py | 5 ++ .../tests/samplebinding/virtualmethods_test.py | 5 ++ .../tests/samplebinding/visibilitychange_test.py | 6 ++ .../tests/samplebinding/voidholder_test.py | 6 ++ .../shiboken2/tests/samplebinding/weakref_test.py | 8 ++- .../tests/samplebinding/writableclassdict_test.py | 7 ++ sources/shiboken2/tests/shiboken_paths.py | 74 ++++++++++++++++++++++ .../shiboken2/tests/shibokenmodule/module_test.py | 9 ++- .../tests/smartbinding/smart_pointer_test.py | 5 ++ 143 files changed, 919 insertions(+), 32 deletions(-) mode change 100755 => 100644 sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py mode change 100755 => 100644 sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py mode change 100755 => 100644 sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py mode change 100755 => 100644 sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py mode change 100755 => 100644 sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py mode change 100755 => 100644 sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py create mode 100644 sources/shiboken2/tests/shiboken_paths.py (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/tests/CMakeLists.txt b/sources/shiboken2/tests/CMakeLists.txt index 464707a9a..375215369 100644 --- a/sources/shiboken2/tests/CMakeLists.txt +++ b/sources/shiboken2/tests/CMakeLists.txt @@ -45,25 +45,15 @@ endif() if(CMAKE_VERSION VERSION_LESS 2.8) message("CMake version greater than 2.8 necessary to run tests") else() - if(WIN32) - set(TEST_PYTHONPATH "${smart_BINARY_DIR};${minimal_BINARY_DIR};${sample_BINARY_DIR};${other_BINARY_DIR};${shibokenmodule_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}") - set(TEST_LIBRARY_PATH "$ENV{PATH};${libminimal_BINARY_DIR};${libsample_BINARY_DIR};${libother_BINARY_DIR};${libsmart_BINARY_DIR};${libshiboken_BINARY_DIR}") - set(LIBRARY_PATH_VAR "PATH") - string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}") - string(REPLACE "\\" "/" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}") - string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}") - string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}") - else() - set(TEST_PYTHONPATH "${smart_BINARY_DIR}:${minimal_BINARY_DIR}:${sample_BINARY_DIR}:${other_BINARY_DIR}:${shibokenmodule_BINARY_DIR}:${CMAKE_CURRENT_SOURCE_DIR}") - set(TEST_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}:${libminimal_BINARY_DIR}:${libsample_BINARY_DIR}:${libother_BINARY_DIR}:${libsmart_BINARY_DIR}:${libshiboken_BINARY_DIR}") - set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH") - endif() + get_filename_component(BUILD_DIR "${libminimal_BINARY_DIR}" DIRECTORY) + get_filename_component(BUILD_DIR "${BUILD_DIR}" DIRECTORY) + get_filename_component(BUILD_DIR "${BUILD_DIR}" DIRECTORY) foreach(test_file ${TEST_FILES}) string(REGEX MATCH "/([^/]+)(binding|module)/([^/]+)_test.py" tmp ${test_file}) set(test_name "${CMAKE_MATCH_1}_${CMAKE_MATCH_3}") list(FIND test_blacklist ${test_name} expect_fail) add_test(${test_name} ${PYTHON_EXECUTABLE} ${test_file}) - set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "PYTHONPATH=${TEST_PYTHONPATH};${LIBRARY_PATH_VAR}=${TEST_LIBRARY_PATH}") + set_tests_properties(${test_name} PROPERTIES ENVIRONMENT "BUILD_DIR=${BUILD_DIR}") set_tests_properties(${test_name} PROPERTIES TIMEOUT ${CTEST_TESTING_TIMEOUT}) if (${expect_fail} GREATER -1) set_tests_properties(${test_name} PROPERTIES WILL_FAIL TRUE) diff --git a/sources/shiboken2/tests/minimalbinding/brace_pattern_test.py b/sources/shiboken2/tests/minimalbinding/brace_pattern_test.py index 89df998e8..e48027d2a 100644 --- a/sources/shiboken2/tests/minimalbinding/brace_pattern_test.py +++ b/sources/shiboken2/tests/minimalbinding/brace_pattern_test.py @@ -39,15 +39,19 @@ from __future__ import absolute_import, print_function +import os import re import sys -import os +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import shiboken2 type.__signature__ # trigger bootstrap from shibokensupport.signature.lib.tool import build_brace_pattern -import unittest """ This test tests the brace pattern from signature.lib.tool diff --git a/sources/shiboken2/tests/minimalbinding/listuser_test.py b/sources/shiboken2/tests/minimalbinding/listuser_test.py index 52ba9781f..e69bce346 100644 --- a/sources/shiboken2/tests/minimalbinding/listuser_test.py +++ b/sources/shiboken2/tests/minimalbinding/listuser_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from minimal import ListUser, Val, Obj from py3kcompat import IS_PY3K diff --git a/sources/shiboken2/tests/minimalbinding/minbool_test.py b/sources/shiboken2/tests/minimalbinding/minbool_test.py index 020e9a41f..adc0929fd 100644 --- a/sources/shiboken2/tests/minimalbinding/minbool_test.py +++ b/sources/shiboken2/tests/minimalbinding/minbool_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from minimal import MinBoolUser class DerivedMinBoolUser (MinBoolUser): diff --git a/sources/shiboken2/tests/minimalbinding/obj_test.py b/sources/shiboken2/tests/minimalbinding/obj_test.py index b97f8b1d2..a0869a67b 100644 --- a/sources/shiboken2/tests/minimalbinding/obj_test.py +++ b/sources/shiboken2/tests/minimalbinding/obj_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from minimal import Obj class ExtObj(Obj): diff --git a/sources/shiboken2/tests/minimalbinding/typedef_test.py b/sources/shiboken2/tests/minimalbinding/typedef_test.py index e58337060..6595d0467 100644 --- a/sources/shiboken2/tests/minimalbinding/typedef_test.py +++ b/sources/shiboken2/tests/minimalbinding/typedef_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from minimal import * from py3kcompat import IS_PY3K diff --git a/sources/shiboken2/tests/minimalbinding/val_test.py b/sources/shiboken2/tests/minimalbinding/val_test.py index 7a10f29a1..f97e9487d 100644 --- a/sources/shiboken2/tests/minimalbinding/val_test.py +++ b/sources/shiboken2/tests/minimalbinding/val_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from minimal import Val diff --git a/sources/shiboken2/tests/otherbinding/collector_external_operator_test.py b/sources/shiboken2/tests/otherbinding/collector_external_operator_test.py index b65663f9d..6014b8a59 100644 --- a/sources/shiboken2/tests/otherbinding/collector_external_operator_test.py +++ b/sources/shiboken2/tests/otherbinding/collector_external_operator_test.py @@ -31,8 +31,14 @@ '''Test cases for Collector shift operators defined in other modules.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Collector, ObjectType from other import OtherObjectType diff --git a/sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py b/sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py old mode 100755 new mode 100644 index 2aba4bd09..1e992ebc8 --- a/sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py +++ b/sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py @@ -33,8 +33,14 @@ being that the latter defines a new conversion operator for the former, and this one has no implicit conversions.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import NoImplicitConversion from other import ExtendsNoImplicitConversion diff --git a/sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py b/sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py old mode 100755 new mode 100644 index 0c58fbf5b..5ad4763b7 --- a/sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py +++ b/sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py @@ -31,8 +31,14 @@ '''Test cases for libsample's Point multiply operator defined in libother module.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point from other import Number diff --git a/sources/shiboken2/tests/otherbinding/module_reload_test.py b/sources/shiboken2/tests/otherbinding/module_reload_test.py index 0010130f9..368425cd0 100644 --- a/sources/shiboken2/tests/otherbinding/module_reload_test.py +++ b/sources/shiboken2/tests/otherbinding/module_reload_test.py @@ -30,10 +30,14 @@ ############################################################################# import os -import sys import shutil +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from py3kcompat import IS_PY3K if IS_PY3K: diff --git a/sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py b/sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py old mode 100755 new mode 100644 index 09988496a..84dfe9839 --- a/sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py +++ b/sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py @@ -31,8 +31,14 @@ '''Tests calling Str constructor using a Number parameter, being that number defines a cast operator to Str.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Str from other import Number diff --git a/sources/shiboken2/tests/otherbinding/objtypehashes_test.py b/sources/shiboken2/tests/otherbinding/objtypehashes_test.py index a52957481..92f93a090 100644 --- a/sources/shiboken2/tests/otherbinding/objtypehashes_test.py +++ b/sources/shiboken2/tests/otherbinding/objtypehashes_test.py @@ -26,7 +26,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import * from other import * import shiboken2 as shiboken diff --git a/sources/shiboken2/tests/otherbinding/otherderived_test.py b/sources/shiboken2/tests/otherbinding/otherderived_test.py index e6ed761b4..d8dc9b686 100644 --- a/sources/shiboken2/tests/otherbinding/otherderived_test.py +++ b/sources/shiboken2/tests/otherbinding/otherderived_test.py @@ -31,9 +31,14 @@ '''Test cases for OtherDerived class''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Abstract, Derived from other import OtherDerived, Number diff --git a/sources/shiboken2/tests/otherbinding/typediscovery_test.py b/sources/shiboken2/tests/otherbinding/typediscovery_test.py index a9eb88d80..200d091b0 100644 --- a/sources/shiboken2/tests/otherbinding/typediscovery_test.py +++ b/sources/shiboken2/tests/otherbinding/typediscovery_test.py @@ -31,8 +31,14 @@ '''Test cases for type discovery''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Abstract, Base1, Derived, MDerived1, MDerived3, SonOfMDerived1 from other import OtherMultipleDerived diff --git a/sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py b/sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py old mode 100755 new mode 100644 index fe13cf601..a69ee23f0 --- a/sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py +++ b/sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py @@ -31,7 +31,13 @@ '''Tests user defined primitive type from a required module.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from other import Number class UserDefinedPrimitiveTypeFromRequiredModuleTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/otherbinding/wrongctor_test.py b/sources/shiboken2/tests/otherbinding/wrongctor_test.py index 15f43d0ca..29d085315 100644 --- a/sources/shiboken2/tests/otherbinding/wrongctor_test.py +++ b/sources/shiboken2/tests/otherbinding/wrongctor_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import * from other import * diff --git a/sources/shiboken2/tests/samplebinding/__del___test.py b/sources/shiboken2/tests/samplebinding/__del___test.py index 0f34ebb27..eba837eb8 100644 --- a/sources/shiboken2/tests/samplebinding/__del___test.py +++ b/sources/shiboken2/tests/samplebinding/__del___test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample delCalled = False diff --git a/sources/shiboken2/tests/samplebinding/abstract_test.py b/sources/shiboken2/tests/samplebinding/abstract_test.py index 33358ad2a..23a984870 100644 --- a/sources/shiboken2/tests/samplebinding/abstract_test.py +++ b/sources/shiboken2/tests/samplebinding/abstract_test.py @@ -31,9 +31,14 @@ '''Test cases for Abstract class''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Abstract class Incomplete(Abstract): diff --git a/sources/shiboken2/tests/samplebinding/addedfunction_test.py b/sources/shiboken2/tests/samplebinding/addedfunction_test.py index 57cebbb3a..d7f5f3994 100644 --- a/sources/shiboken2/tests/samplebinding/addedfunction_test.py +++ b/sources/shiboken2/tests/samplebinding/addedfunction_test.py @@ -31,7 +31,13 @@ '''Test cases for added functions.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import SampleNamespace, ObjectType, Point class TestAddedFunctionsWithSimilarTypes(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/addedfunction_with_container_args_test.py b/sources/shiboken2/tests/samplebinding/addedfunction_with_container_args_test.py index 0954ba470..9666b251c 100644 --- a/sources/shiboken2/tests/samplebinding/addedfunction_with_container_args_test.py +++ b/sources/shiboken2/tests/samplebinding/addedfunction_with_container_args_test.py @@ -31,7 +31,13 @@ '''Test cases for added functions with nested and multi-argument container types.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import sum2d, sumproduct class TestAddedFunctionsWithContainerArgs(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/argumentmodifications_test.py b/sources/shiboken2/tests/samplebinding/argumentmodifications_test.py index aa27de331..8a2775db3 100644 --- a/sources/shiboken2/tests/samplebinding/argumentmodifications_test.py +++ b/sources/shiboken2/tests/samplebinding/argumentmodifications_test.py @@ -31,9 +31,14 @@ '''Test cases for method arguments modifications performed as described on typesystem.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Modifications, Point class ArgumentModificationsTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/array_numpy_test.py b/sources/shiboken2/tests/samplebinding/array_numpy_test.py index 37536930d..2c2a2852a 100644 --- a/sources/shiboken2/tests/samplebinding/array_numpy_test.py +++ b/sources/shiboken2/tests/samplebinding/array_numpy_test.py @@ -30,7 +30,13 @@ '''Test case for NumPy Array types.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sample hasNumPy = False diff --git a/sources/shiboken2/tests/samplebinding/array_sequence_test.py b/sources/shiboken2/tests/samplebinding/array_sequence_test.py index ac8217054..520a5f928 100644 --- a/sources/shiboken2/tests/samplebinding/array_sequence_test.py +++ b/sources/shiboken2/tests/samplebinding/array_sequence_test.py @@ -30,7 +30,13 @@ '''Test case for Array types (PySequence).''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sample class ArrayTester(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/bug_554_test.py b/sources/shiboken2/tests/samplebinding/bug_554_test.py index 85848fc39..c1c06a17f 100644 --- a/sources/shiboken2/tests/samplebinding/bug_554_test.py +++ b/sources/shiboken2/tests/samplebinding/bug_554_test.py @@ -31,6 +31,12 @@ '''Unit test for bug#554''' +import os +import sys +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class Bug554: diff --git a/sources/shiboken2/tests/samplebinding/bug_704_test.py b/sources/shiboken2/tests/samplebinding/bug_704_test.py index 9aa865327..28c90aba4 100644 --- a/sources/shiboken2/tests/samplebinding/bug_704_test.py +++ b/sources/shiboken2/tests/samplebinding/bug_704_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from py3kcompat import IS_PY3K from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/bytearray_test.py b/sources/shiboken2/tests/samplebinding/bytearray_test.py index e19271ca9..f1094e54e 100644 --- a/sources/shiboken2/tests/samplebinding/bytearray_test.py +++ b/sources/shiboken2/tests/samplebinding/bytearray_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from os.path import isdir from sample import ByteArray from py3kcompat import b diff --git a/sources/shiboken2/tests/samplebinding/child_return_test.py b/sources/shiboken2/tests/samplebinding/child_return_test.py index 49c843160..28fde4926 100644 --- a/sources/shiboken2/tests/samplebinding/child_return_test.py +++ b/sources/shiboken2/tests/samplebinding/child_return_test.py @@ -31,9 +31,14 @@ '''The BlackBox class has cases of ownership transference between C++ and Python.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class ReturnOfChildTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/class_fields_test.py b/sources/shiboken2/tests/samplebinding/class_fields_test.py index 6dbacbd97..202efcafb 100644 --- a/sources/shiboken2/tests/samplebinding/class_fields_test.py +++ b/sources/shiboken2/tests/samplebinding/class_fields_test.py @@ -31,9 +31,15 @@ '''Simple test case for accessing the exposed C++ class fields.''' +import os +import sys from sys import getrefcount import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Derived, Point, ObjectType class TestAccessingCppFields(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/collector_test.py b/sources/shiboken2/tests/samplebinding/collector_test.py index f0b184a90..d6d10165e 100644 --- a/sources/shiboken2/tests/samplebinding/collector_test.py +++ b/sources/shiboken2/tests/samplebinding/collector_test.py @@ -31,9 +31,14 @@ '''Test cases for Collector class' shift operators.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Collector, IntWrapper, ObjectType diff --git a/sources/shiboken2/tests/samplebinding/complex_test.py b/sources/shiboken2/tests/samplebinding/complex_test.py index e14b07b91..bff7b5828 100644 --- a/sources/shiboken2/tests/samplebinding/complex_test.py +++ b/sources/shiboken2/tests/samplebinding/complex_test.py @@ -31,9 +31,14 @@ '''Test cases for Complex class''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample from sample import Point diff --git a/sources/shiboken2/tests/samplebinding/conversion_operator_test.py b/sources/shiboken2/tests/samplebinding/conversion_operator_test.py index 5faaaa4db..a18d27a0c 100644 --- a/sources/shiboken2/tests/samplebinding/conversion_operator_test.py +++ b/sources/shiboken2/tests/samplebinding/conversion_operator_test.py @@ -31,8 +31,14 @@ '''Test cases for implicit conversion generated by conversion operator.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Time, StrList class ConversionOperatorTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/copy_test.py b/sources/shiboken2/tests/samplebinding/copy_test.py index 7505454a2..a8e02d979 100644 --- a/sources/shiboken2/tests/samplebinding/copy_test.py +++ b/sources/shiboken2/tests/samplebinding/copy_test.py @@ -32,8 +32,14 @@ '''Test cases for deep copy of objects''' import copy +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + try: import cPickle as pickle except ImportError: diff --git a/sources/shiboken2/tests/samplebinding/ctorconvrule_test.py b/sources/shiboken2/tests/samplebinding/ctorconvrule_test.py index b7efead63..7fd9b502c 100644 --- a/sources/shiboken2/tests/samplebinding/ctorconvrule_test.py +++ b/sources/shiboken2/tests/samplebinding/ctorconvrule_test.py @@ -31,8 +31,14 @@ '''Test cases for proper generation of constructor altered by conversion-rule tag.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import CtorConvRule class TestCtorConvRule(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/cyclic_test.py b/sources/shiboken2/tests/samplebinding/cyclic_test.py index 1940c8d2f..8fe029d59 100644 --- a/sources/shiboken2/tests/samplebinding/cyclic_test.py +++ b/sources/shiboken2/tests/samplebinding/cyclic_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType from sample import ObjectView from sample import ObjectModel diff --git a/sources/shiboken2/tests/samplebinding/date_test.py b/sources/shiboken2/tests/samplebinding/date_test.py index fe7b9ac18..0a89db871 100644 --- a/sources/shiboken2/tests/samplebinding/date_test.py +++ b/sources/shiboken2/tests/samplebinding/date_test.py @@ -31,8 +31,13 @@ '''Test cases for python conversions types ''' +import os import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from datetime import date from sample import SbkDate diff --git a/sources/shiboken2/tests/samplebinding/decisor_test.py b/sources/shiboken2/tests/samplebinding/decisor_test.py index 734c43760..e98e45bfc 100644 --- a/sources/shiboken2/tests/samplebinding/decisor_test.py +++ b/sources/shiboken2/tests/samplebinding/decisor_test.py @@ -31,8 +31,14 @@ '''Test cases for the method overload decisor.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import SampleNamespace, Point, ObjectType, ObjectModel class DecisorTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/delete_test.py b/sources/shiboken2/tests/samplebinding/delete_test.py index 780da415c..b35bba4b0 100644 --- a/sources/shiboken2/tests/samplebinding/delete_test.py +++ b/sources/shiboken2/tests/samplebinding/delete_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sample import shiboken2 as shiboken diff --git a/sources/shiboken2/tests/samplebinding/deprecated_test.py b/sources/shiboken2/tests/samplebinding/deprecated_test.py index b08f65271..d75490e17 100644 --- a/sources/shiboken2/tests/samplebinding/deprecated_test.py +++ b/sources/shiboken2/tests/samplebinding/deprecated_test.py @@ -29,8 +29,14 @@ ## ############################################################################# -import warnings +import os +import sys import unittest +import warnings + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/derived_test.py b/sources/shiboken2/tests/samplebinding/derived_test.py index 05cd648f5..81f3a8034 100644 --- a/sources/shiboken2/tests/samplebinding/derived_test.py +++ b/sources/shiboken2/tests/samplebinding/derived_test.py @@ -31,9 +31,14 @@ '''Test cases for Derived class''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample from sample import Abstract, Derived, OverloadedFuncEnum diff --git a/sources/shiboken2/tests/samplebinding/duck_punching_test.py b/sources/shiboken2/tests/samplebinding/duck_punching_test.py index efc8f344f..3f9d69b47 100644 --- a/sources/shiboken2/tests/samplebinding/duck_punching_test.py +++ b/sources/shiboken2/tests/samplebinding/duck_punching_test.py @@ -31,8 +31,14 @@ '''Test cases for virtual methods.''' +import os +import sys import types import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from py3kcompat import IS_PY3K from sample import VirtualMethods, SimpleFile, Point diff --git a/sources/shiboken2/tests/samplebinding/echo_test.py b/sources/shiboken2/tests/samplebinding/echo_test.py index b91394bb8..cd3fcc090 100644 --- a/sources/shiboken2/tests/samplebinding/echo_test.py +++ b/sources/shiboken2/tests/samplebinding/echo_test.py @@ -31,8 +31,14 @@ '''Test cases for with const char* as argument''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Echo class TestEcho(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/enum_test.py b/sources/shiboken2/tests/samplebinding/enum_test.py index 7e1cac8c0..c8a3d30f1 100644 --- a/sources/shiboken2/tests/samplebinding/enum_test.py +++ b/sources/shiboken2/tests/samplebinding/enum_test.py @@ -35,6 +35,10 @@ import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample from sample import SampleNamespace, ObjectType, Event from py3kcompat import IS_PY3K, b diff --git a/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py b/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py index 5803a9975..4b0866c4e 100644 --- a/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py +++ b/sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample class TestEnumFromRemovedNamespace(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/event_loop_call_virtual_test.py b/sources/shiboken2/tests/samplebinding/event_loop_call_virtual_test.py index 63a5a8ab3..41b91ed70 100644 --- a/sources/shiboken2/tests/samplebinding/event_loop_call_virtual_test.py +++ b/sources/shiboken2/tests/samplebinding/event_loop_call_virtual_test.py @@ -30,8 +30,14 @@ '''Simple event loop dispatcher test.''' +import os +import sys import time import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from random import random from sample import ObjectType, Event diff --git a/sources/shiboken2/tests/samplebinding/event_loop_thread_test.py b/sources/shiboken2/tests/samplebinding/event_loop_thread_test.py index 1a1fe840d..4c63d0665 100644 --- a/sources/shiboken2/tests/samplebinding/event_loop_thread_test.py +++ b/sources/shiboken2/tests/samplebinding/event_loop_thread_test.py @@ -28,10 +28,16 @@ ## ############################################################################# +import os +from random import random +import sys import time import threading import unittest -from random import random + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType, Event diff --git a/sources/shiboken2/tests/samplebinding/exception_test.py b/sources/shiboken2/tests/samplebinding/exception_test.py index d6c02433a..3224dfe17 100644 --- a/sources/shiboken2/tests/samplebinding/exception_test.py +++ b/sources/shiboken2/tests/samplebinding/exception_test.py @@ -28,8 +28,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ExceptionTest class CppExceptionTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/filter_test.py b/sources/shiboken2/tests/samplebinding/filter_test.py index 577a15bd2..b09d89980 100644 --- a/sources/shiboken2/tests/samplebinding/filter_test.py +++ b/sources/shiboken2/tests/samplebinding/filter_test.py @@ -26,8 +26,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Data, Intersection, Union class TestFilters(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/handleholder_test.py b/sources/shiboken2/tests/samplebinding/handleholder_test.py index c2504f4d2..a4cbd1c72 100644 --- a/sources/shiboken2/tests/samplebinding/handleholder_test.py +++ b/sources/shiboken2/tests/samplebinding/handleholder_test.py @@ -33,8 +33,14 @@ Test case for BUG #1105. ''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import HandleHolder class HandleHolderTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/hashabletype_test.py b/sources/shiboken2/tests/samplebinding/hashabletype_test.py index c628c1751..b985abaad 100644 --- a/sources/shiboken2/tests/samplebinding/hashabletype_test.py +++ b/sources/shiboken2/tests/samplebinding/hashabletype_test.py @@ -31,8 +31,14 @@ '''Test cases for __hash__''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class HashableTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/ignorederefop_test.py b/sources/shiboken2/tests/samplebinding/ignorederefop_test.py index c5f53a981..2237443b3 100644 --- a/sources/shiboken2/tests/samplebinding/ignorederefop_test.py +++ b/sources/shiboken2/tests/samplebinding/ignorederefop_test.py @@ -26,7 +26,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import * class TestLackOfDereferenceOperators (unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/implicitconv_numerical_test.py b/sources/shiboken2/tests/samplebinding/implicitconv_numerical_test.py index 6ebca790c..ebecf9ad8 100644 --- a/sources/shiboken2/tests/samplebinding/implicitconv_numerical_test.py +++ b/sources/shiboken2/tests/samplebinding/implicitconv_numerical_test.py @@ -31,7 +31,13 @@ '''Test case for inplicit converting C++ numeric types.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sys import sample from py3kcompat import IS_PY3K, l, long diff --git a/sources/shiboken2/tests/samplebinding/implicitconv_test.py b/sources/shiboken2/tests/samplebinding/implicitconv_test.py index 30986d576..a6b770c9b 100644 --- a/sources/shiboken2/tests/samplebinding/implicitconv_test.py +++ b/sources/shiboken2/tests/samplebinding/implicitconv_test.py @@ -31,8 +31,14 @@ '''Test cases for implicit conversions''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ImplicitConv, ObjectType class ImplicitConvTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py b/sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py old mode 100755 new mode 100644 index 892a2bc93..6b8a91573 --- a/sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py +++ b/sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py @@ -31,8 +31,14 @@ '''Test cases for finding scope in cases involving inheritance.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import SampleNamespace class ScopeAndInheritanceTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/injectcode_test.py b/sources/shiboken2/tests/samplebinding/injectcode_test.py index d6b1d0686..8bdcdbe61 100644 --- a/sources/shiboken2/tests/samplebinding/injectcode_test.py +++ b/sources/shiboken2/tests/samplebinding/injectcode_test.py @@ -31,7 +31,13 @@ '''Test cases for std::list container conversions''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import InjectCode class MyInjectCode(InjectCode): diff --git a/sources/shiboken2/tests/samplebinding/innerclass_test.py b/sources/shiboken2/tests/samplebinding/innerclass_test.py index d76840f5c..287726587 100644 --- a/sources/shiboken2/tests/samplebinding/innerclass_test.py +++ b/sources/shiboken2/tests/samplebinding/innerclass_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Derived class TestInnerClass(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/intlist_test.py b/sources/shiboken2/tests/samplebinding/intlist_test.py index 3bf8fb0ef..19043b99c 100644 --- a/sources/shiboken2/tests/samplebinding/intlist_test.py +++ b/sources/shiboken2/tests/samplebinding/intlist_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import IntList class IntListTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/invalid_virtual_return_test.py b/sources/shiboken2/tests/samplebinding/invalid_virtual_return_test.py index 63384e737..36e583a4f 100644 --- a/sources/shiboken2/tests/samplebinding/invalid_virtual_return_test.py +++ b/sources/shiboken2/tests/samplebinding/invalid_virtual_return_test.py @@ -31,7 +31,13 @@ '''Test case for returning invalid types in a virtual function''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectModel, ObjectType, ObjectView import warnings diff --git a/sources/shiboken2/tests/samplebinding/keep_reference_test.py b/sources/shiboken2/tests/samplebinding/keep_reference_test.py index bcfc0db1b..db3ddc2d4 100644 --- a/sources/shiboken2/tests/samplebinding/keep_reference_test.py +++ b/sources/shiboken2/tests/samplebinding/keep_reference_test.py @@ -31,8 +31,14 @@ '''Test case for objects that keep references to other object without owning them (e.g. model/view relationships).''' -import unittest +import os +import sys from sys import getrefcount +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectModel, ObjectView diff --git a/sources/shiboken2/tests/samplebinding/list_test.py b/sources/shiboken2/tests/samplebinding/list_test.py index a2761bee3..74091422c 100644 --- a/sources/shiboken2/tests/samplebinding/list_test.py +++ b/sources/shiboken2/tests/samplebinding/list_test.py @@ -31,8 +31,14 @@ '''Test cases for std::list container conversions''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ListUser, Point, PointF class ExtendedListUser(ListUser): diff --git a/sources/shiboken2/tests/samplebinding/lock_test.py b/sources/shiboken2/tests/samplebinding/lock_test.py index 9bb1f8789..93c632e34 100644 --- a/sources/shiboken2/tests/samplebinding/lock_test.py +++ b/sources/shiboken2/tests/samplebinding/lock_test.py @@ -31,8 +31,14 @@ '''Simple test with a blocking C++ method that should allow python threads to run.''' -import unittest +import os +import sys import threading +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import Bucket diff --git a/sources/shiboken2/tests/samplebinding/map_test.py b/sources/shiboken2/tests/samplebinding/map_test.py index 1d8d758d8..f6696c3d8 100644 --- a/sources/shiboken2/tests/samplebinding/map_test.py +++ b/sources/shiboken2/tests/samplebinding/map_test.py @@ -31,8 +31,14 @@ '''Test cases for std::map container conversions''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import MapUser class ExtendedMapUser(MapUser): diff --git a/sources/shiboken2/tests/samplebinding/metaclass_test.py b/sources/shiboken2/tests/samplebinding/metaclass_test.py index e5da496c5..ad4c08f0d 100644 --- a/sources/shiboken2/tests/samplebinding/metaclass_test.py +++ b/sources/shiboken2/tests/samplebinding/metaclass_test.py @@ -26,9 +26,16 @@ ## ############################################################################# -from sample import * +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + +from sample import * + class MetaA(type): pass diff --git a/sources/shiboken2/tests/samplebinding/mi_virtual_methods_test.py b/sources/shiboken2/tests/samplebinding/mi_virtual_methods_test.py index 585a1a2df..aea8a4d46 100644 --- a/sources/shiboken2/tests/samplebinding/mi_virtual_methods_test.py +++ b/sources/shiboken2/tests/samplebinding/mi_virtual_methods_test.py @@ -31,8 +31,14 @@ '''Test cases for virtual methods in multiple inheritance scenarios''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import VirtualMethods, ObjectType, Event diff --git a/sources/shiboken2/tests/samplebinding/mixed_mi_test.py b/sources/shiboken2/tests/samplebinding/mixed_mi_test.py index dd557d4f6..d33d033ba 100644 --- a/sources/shiboken2/tests/samplebinding/mixed_mi_test.py +++ b/sources/shiboken2/tests/samplebinding/mixed_mi_test.py @@ -31,8 +31,14 @@ '''Test cases for multiple inheritance in mixed Python/C++ scenarios''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/modelindex_test.py b/sources/shiboken2/tests/samplebinding/modelindex_test.py index 251ee710a..905d14269 100644 --- a/sources/shiboken2/tests/samplebinding/modelindex_test.py +++ b/sources/shiboken2/tests/samplebinding/modelindex_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ModelIndex, ReferentModelIndex, PersistentModelIndex class TestCastOperator(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/modelview_test.py b/sources/shiboken2/tests/samplebinding/modelview_test.py index 3f86fe4ea..f421ca41d 100644 --- a/sources/shiboken2/tests/samplebinding/modelview_test.py +++ b/sources/shiboken2/tests/samplebinding/modelview_test.py @@ -31,7 +31,13 @@ '''Test case for objects that keep references to other object without owning them (e.g. model/view relationships).''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectModel, ObjectType, ObjectView diff --git a/sources/shiboken2/tests/samplebinding/modifications_test.py b/sources/shiboken2/tests/samplebinding/modifications_test.py index e9a1eaf7f..e6e9c5626 100644 --- a/sources/shiboken2/tests/samplebinding/modifications_test.py +++ b/sources/shiboken2/tests/samplebinding/modifications_test.py @@ -31,8 +31,14 @@ '''Test cases for method modifications performed as described on type system. ''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Modifications, Point, ByteArray class ExtModifications(Modifications): diff --git a/sources/shiboken2/tests/samplebinding/modified_constructor_test.py b/sources/shiboken2/tests/samplebinding/modified_constructor_test.py index 3352cd277..11d931c5f 100644 --- a/sources/shiboken2/tests/samplebinding/modified_constructor_test.py +++ b/sources/shiboken2/tests/samplebinding/modified_constructor_test.py @@ -31,9 +31,15 @@ '''Tests cases for ConstructorWithModifiedArgument class.''' +import sys +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * diff --git a/sources/shiboken2/tests/samplebinding/modifiedvirtualmethods_test.py b/sources/shiboken2/tests/samplebinding/modifiedvirtualmethods_test.py index 53b854530..c15a0db08 100644 --- a/sources/shiboken2/tests/samplebinding/modifiedvirtualmethods_test.py +++ b/sources/shiboken2/tests/samplebinding/modifiedvirtualmethods_test.py @@ -31,8 +31,14 @@ '''Test cases for modified virtual methods.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import VirtualMethods, Str class ExtendedVirtualMethods(VirtualMethods): diff --git a/sources/shiboken2/tests/samplebinding/multi_cpp_inheritance_test.py b/sources/shiboken2/tests/samplebinding/multi_cpp_inheritance_test.py index 5223f316a..c64a29e8e 100644 --- a/sources/shiboken2/tests/samplebinding/multi_cpp_inheritance_test.py +++ b/sources/shiboken2/tests/samplebinding/multi_cpp_inheritance_test.py @@ -31,9 +31,14 @@ '''Test cases for multiple inheritance''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class SimpleUseCase(ObjectType, Str): diff --git a/sources/shiboken2/tests/samplebinding/multiple_derived_test.py b/sources/shiboken2/tests/samplebinding/multiple_derived_test.py index 9ac206db3..650af8602 100644 --- a/sources/shiboken2/tests/samplebinding/multiple_derived_test.py +++ b/sources/shiboken2/tests/samplebinding/multiple_derived_test.py @@ -31,9 +31,14 @@ '''Test cases for multiple inheritance''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Base1, Base2, Base3, Base4, Base5, Base6 from sample import MDerived1, MDerived2, MDerived3, MDerived4, MDerived5, SonOfMDerived1 diff --git a/sources/shiboken2/tests/samplebinding/namespace_test.py b/sources/shiboken2/tests/samplebinding/namespace_test.py index 5fcdab974..aeaf81cff 100644 --- a/sources/shiboken2/tests/samplebinding/namespace_test.py +++ b/sources/shiboken2/tests/samplebinding/namespace_test.py @@ -31,7 +31,14 @@ '''Test cases for std::map container conversions''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * diff --git a/sources/shiboken2/tests/samplebinding/newdivision_test.py b/sources/shiboken2/tests/samplebinding/newdivision_test.py index 331d7b365..d352c1b91 100644 --- a/sources/shiboken2/tests/samplebinding/newdivision_test.py +++ b/sources/shiboken2/tests/samplebinding/newdivision_test.py @@ -27,9 +27,17 @@ ############################################################################# from __future__ import division -from sample import * +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + +from sample import * + + class TestNewDivision(unittest.TestCase): def testIt(self): diff --git a/sources/shiboken2/tests/samplebinding/nondefaultctor_test.py b/sources/shiboken2/tests/samplebinding/nondefaultctor_test.py index 86a05fd78..68d083136 100644 --- a/sources/shiboken2/tests/samplebinding/nondefaultctor_test.py +++ b/sources/shiboken2/tests/samplebinding/nondefaultctor_test.py @@ -31,9 +31,14 @@ '''Test cases for ...''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import NonDefaultCtor class DerivedNonDefaultCtor (NonDefaultCtor): diff --git a/sources/shiboken2/tests/samplebinding/nontypetemplate_test.py b/sources/shiboken2/tests/samplebinding/nontypetemplate_test.py index a7a4da72b..7c4729b4f 100644 --- a/sources/shiboken2/tests/samplebinding/nontypetemplate_test.py +++ b/sources/shiboken2/tests/samplebinding/nontypetemplate_test.py @@ -36,8 +36,14 @@ try: except ImportError: pass +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import IntArray2, IntArray3 class NonTypeTemplateTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/nonzero_test.py b/sources/shiboken2/tests/samplebinding/nonzero_test.py index 138a92264..214b2f7bd 100644 --- a/sources/shiboken2/tests/samplebinding/nonzero_test.py +++ b/sources/shiboken2/tests/samplebinding/nonzero_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class TestNonZeroOperator(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/numericaltypedef_test.py b/sources/shiboken2/tests/samplebinding/numericaltypedef_test.py index f82e23424..de9128cbc 100644 --- a/sources/shiboken2/tests/samplebinding/numericaltypedef_test.py +++ b/sources/shiboken2/tests/samplebinding/numericaltypedef_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import SizeF class NumericalTypedefTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/numpy_test.py b/sources/shiboken2/tests/samplebinding/numpy_test.py index 90b97992a..3f67f59e4 100644 --- a/sources/shiboken2/tests/samplebinding/numpy_test.py +++ b/sources/shiboken2/tests/samplebinding/numpy_test.py @@ -36,7 +36,13 @@ try: except: sys.exit(0) +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import PointF class TestNumpyTypes(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/objecttype_test.py b/sources/shiboken2/tests/samplebinding/objecttype_test.py index f1a06c2b1..1d7f70722 100644 --- a/sources/shiboken2/tests/samplebinding/objecttype_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttype_test.py @@ -31,7 +31,13 @@ '''Tests ObjectType class of object-type with privates copy constructor and = operator.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sys from sample import ObjectType, Str diff --git a/sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py b/sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py old mode 100755 new mode 100644 index 846ae5108..ce7874c23 --- a/sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType class NamedArgsTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/objecttypebyvalue_test.py b/sources/shiboken2/tests/samplebinding/objecttypebyvalue_test.py index 31cbe29cc..080a51ce5 100644 --- a/sources/shiboken2/tests/samplebinding/objecttypebyvalue_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttypebyvalue_test.py @@ -26,9 +26,17 @@ ## ############################################################################# -from sample import * +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + +from sample import * + + class ObjectTypeByValueTest (unittest.TestCase): def testIt(self): factory = ObjectTypeByValue() diff --git a/sources/shiboken2/tests/samplebinding/objecttypelayout_test.py b/sources/shiboken2/tests/samplebinding/objecttypelayout_test.py index 62f6ce731..bcf30eb43 100644 --- a/sources/shiboken2/tests/samplebinding/objecttypelayout_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttypelayout_test.py @@ -31,9 +31,14 @@ '''Tests cases for ObjectTypeLayout class.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * diff --git a/sources/shiboken2/tests/samplebinding/objecttypeoperators_test.py b/sources/shiboken2/tests/samplebinding/objecttypeoperators_test.py index fa6c2f5b0..fb0d52319 100644 --- a/sources/shiboken2/tests/samplebinding/objecttypeoperators_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttypeoperators_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import * class ObjectTypeOperatorsTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py b/sources/shiboken2/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py index b9ab554dc..40adb94ed 100644 --- a/sources/shiboken2/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py +++ b/sources/shiboken2/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectTypeHolder class TestObjectTypeReferenceAsVirtualMethodArgument(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/oddbool_test.py b/sources/shiboken2/tests/samplebinding/oddbool_test.py index f99645bc6..de1429604 100644 --- a/sources/shiboken2/tests/samplebinding/oddbool_test.py +++ b/sources/shiboken2/tests/samplebinding/oddbool_test.py @@ -31,8 +31,14 @@ '''Test cases for OddBool user's primitive type conversion.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import OddBoolUser class DerivedOddBoolUser (OddBoolUser): diff --git a/sources/shiboken2/tests/samplebinding/oldstyleclass_as_number_test.py b/sources/shiboken2/tests/samplebinding/oldstyleclass_as_number_test.py index 8852e152d..e0f864636 100644 --- a/sources/shiboken2/tests/samplebinding/oldstyleclass_as_number_test.py +++ b/sources/shiboken2/tests/samplebinding/oldstyleclass_as_number_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample from py3kcompat import IS_PY3K diff --git a/sources/shiboken2/tests/samplebinding/onlycopyclass_test.py b/sources/shiboken2/tests/samplebinding/onlycopyclass_test.py index 43a095137..ccf71f4f8 100644 --- a/sources/shiboken2/tests/samplebinding/onlycopyclass_test.py +++ b/sources/shiboken2/tests/samplebinding/onlycopyclass_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import OnlyCopy, FriendOfOnlyCopy class ClassWithOnlyCopyCtorTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/overflow_test.py b/sources/shiboken2/tests/samplebinding/overflow_test.py index b7a1006fe..56a5d98c7 100644 --- a/sources/shiboken2/tests/samplebinding/overflow_test.py +++ b/sources/shiboken2/tests/samplebinding/overflow_test.py @@ -31,9 +31,14 @@ '''Test case for overflowing C++ numeric types.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * from py3kcompat import IS_PY3K, long diff --git a/sources/shiboken2/tests/samplebinding/overload_sorting_test.py b/sources/shiboken2/tests/samplebinding/overload_sorting_test.py index b3b0f7c43..8132e4e3d 100644 --- a/sources/shiboken2/tests/samplebinding/overload_sorting_test.py +++ b/sources/shiboken2/tests/samplebinding/overload_sorting_test.py @@ -31,8 +31,14 @@ '''Test cases for overload sorting''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class Dummy(object): diff --git a/sources/shiboken2/tests/samplebinding/overload_test.py b/sources/shiboken2/tests/samplebinding/overload_test.py index 0cc9e4250..ab5230990 100644 --- a/sources/shiboken2/tests/samplebinding/overload_test.py +++ b/sources/shiboken2/tests/samplebinding/overload_test.py @@ -31,7 +31,13 @@ '''Test cases for Overload class''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import Echo, Overload, Point, PointF, Polygon, Rect, RectF, Size, Str diff --git a/sources/shiboken2/tests/samplebinding/overloadwithdefault_test.py b/sources/shiboken2/tests/samplebinding/overloadwithdefault_test.py index 8db9726c8..dbd318091 100644 --- a/sources/shiboken2/tests/samplebinding/overloadwithdefault_test.py +++ b/sources/shiboken2/tests/samplebinding/overloadwithdefault_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Overload, Str from py3kcompat import b diff --git a/sources/shiboken2/tests/samplebinding/ownership_argument_invalidation_test.py b/sources/shiboken2/tests/samplebinding/ownership_argument_invalidation_test.py index e0b79daa7..d96236c2c 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_argument_invalidation_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_argument_invalidation_test.py @@ -31,9 +31,14 @@ '''Wrapper validity tests for arguments.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Polygon, Point class WrapperValidityOfArgumentsTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_cpp_test.py b/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_cpp_test.py index f0081385a..255f1fdb1 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_cpp_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_cpp_test.py @@ -31,8 +31,14 @@ '''Tests for destroy a child object in C++''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_python_test.py b/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_python_test.py index cac52113d..206a65ce9 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_python_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_delete_child_in_python_test.py @@ -31,9 +31,15 @@ '''Tests for deleting a child object in python''' -import unittest +import os import random import string +import sys +import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType from py3kcompat import IS_PY3K diff --git a/sources/shiboken2/tests/samplebinding/ownership_delete_parent_test.py b/sources/shiboken2/tests/samplebinding/ownership_delete_parent_test.py index cc317df19..1b7de5f2f 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_delete_parent_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_delete_parent_test.py @@ -31,9 +31,14 @@ '''Tests for destroying the parent''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/ownership_invalidate_after_use_test.py b/sources/shiboken2/tests/samplebinding/ownership_invalidate_after_use_test.py index e73b5a8ac..10f1cf9ee 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_invalidate_after_use_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_invalidate_after_use_test.py @@ -31,9 +31,14 @@ '''Ownership tests for cases of invalidation of Python wrapper after use.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType, ObjectTypeDerived, Event diff --git a/sources/shiboken2/tests/samplebinding/ownership_invalidate_child_test.py b/sources/shiboken2/tests/samplebinding/ownership_invalidate_child_test.py index 59bf3f3df..9e6423e50 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_invalidate_child_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_invalidate_child_test.py @@ -31,8 +31,14 @@ '''Tests for invalidating a C++ created child that was already on the care of a parent.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType, BlackBox diff --git a/sources/shiboken2/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py b/sources/shiboken2/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py index d64a2120c..18fce3809 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py @@ -31,9 +31,14 @@ '''The BlackBox class has cases of ownership transference between Python and C++.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point, BlackBox class OwnershipInvalidateNonPolymorphicTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/ownership_invalidate_parent_test.py b/sources/shiboken2/tests/samplebinding/ownership_invalidate_parent_test.py index 42b516ff2..2d7e67deb 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_invalidate_parent_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_invalidate_parent_test.py @@ -31,8 +31,14 @@ '''Tests for invalidating a parent of other objects.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType, BlackBox diff --git a/sources/shiboken2/tests/samplebinding/ownership_reparenting_test.py b/sources/shiboken2/tests/samplebinding/ownership_reparenting_test.py index 1a7ea2379..217566996 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_reparenting_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_reparenting_test.py @@ -31,7 +31,13 @@ '''Tests for object reparenting.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sys from sample import ObjectType diff --git a/sources/shiboken2/tests/samplebinding/ownership_transference_test.py b/sources/shiboken2/tests/samplebinding/ownership_transference_test.py index 42b576a4d..1a783458e 100644 --- a/sources/shiboken2/tests/samplebinding/ownership_transference_test.py +++ b/sources/shiboken2/tests/samplebinding/ownership_transference_test.py @@ -31,9 +31,14 @@ '''The BlackBox class has cases of ownership transference between C++ and Python.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType, BlackBox class BlackBoxTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/pair_test.py b/sources/shiboken2/tests/samplebinding/pair_test.py index ac0653dbe..65fd9b99c 100644 --- a/sources/shiboken2/tests/samplebinding/pair_test.py +++ b/sources/shiboken2/tests/samplebinding/pair_test.py @@ -31,9 +31,14 @@ '''Test cases for std::pair container conversions''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import PairUser class ExtendedPairUser(PairUser): diff --git a/sources/shiboken2/tests/samplebinding/pen_test.py b/sources/shiboken2/tests/samplebinding/pen_test.py index 2a61ae367..408871bb3 100644 --- a/sources/shiboken2/tests/samplebinding/pen_test.py +++ b/sources/shiboken2/tests/samplebinding/pen_test.py @@ -31,8 +31,14 @@ '''Test cases for with const char* as argument''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Color, Pen, SampleNamespace class TestPen(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/point_test.py b/sources/shiboken2/tests/samplebinding/point_test.py index d6498d4b3..e2beb78ae 100644 --- a/sources/shiboken2/tests/samplebinding/point_test.py +++ b/sources/shiboken2/tests/samplebinding/point_test.py @@ -31,9 +31,14 @@ '''Test cases for Point class''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point from py3kcompat import unicode diff --git a/sources/shiboken2/tests/samplebinding/pointerholder_test.py b/sources/shiboken2/tests/samplebinding/pointerholder_test.py index e427e0435..b79eaa33a 100644 --- a/sources/shiboken2/tests/samplebinding/pointerholder_test.py +++ b/sources/shiboken2/tests/samplebinding/pointerholder_test.py @@ -31,9 +31,14 @@ '''Test cases for a class that holds an arbitraty pointer and is modified to hold an PyObject.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import PointerHolder class TestPointerHolder(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/pointerprimitivetype_test.py b/sources/shiboken2/tests/samplebinding/pointerprimitivetype_test.py index c40770862..532f2226c 100644 --- a/sources/shiboken2/tests/samplebinding/pointerprimitivetype_test.py +++ b/sources/shiboken2/tests/samplebinding/pointerprimitivetype_test.py @@ -44,7 +44,13 @@ because typing.Sequence is a subclass, but we will generalize this to typing.Iterable in the future. """ +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import IntArray2, VirtualMethods import shiboken2 diff --git a/sources/shiboken2/tests/samplebinding/pointf_test.py b/sources/shiboken2/tests/samplebinding/pointf_test.py index 8d8b47115..e9630fe40 100644 --- a/sources/shiboken2/tests/samplebinding/pointf_test.py +++ b/sources/shiboken2/tests/samplebinding/pointf_test.py @@ -31,8 +31,14 @@ '''Test cases for PointF class''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import PointF class PointFTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/primitivereferenceargument_test.py b/sources/shiboken2/tests/samplebinding/primitivereferenceargument_test.py index ef0e153e9..95c210b23 100644 --- a/sources/shiboken2/tests/samplebinding/primitivereferenceargument_test.py +++ b/sources/shiboken2/tests/samplebinding/primitivereferenceargument_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sample class PrimitiveReferenceArgumentTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/privatector_test.py b/sources/shiboken2/tests/samplebinding/privatector_test.py index e972512fb..7dc3d6651 100644 --- a/sources/shiboken2/tests/samplebinding/privatector_test.py +++ b/sources/shiboken2/tests/samplebinding/privatector_test.py @@ -32,9 +32,14 @@ '''Test cases for a class with only a private constructor.''' import gc +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import PrivateCtor diff --git a/sources/shiboken2/tests/samplebinding/privatedtor_test.py b/sources/shiboken2/tests/samplebinding/privatedtor_test.py index 478506779..97d034729 100644 --- a/sources/shiboken2/tests/samplebinding/privatedtor_test.py +++ b/sources/shiboken2/tests/samplebinding/privatedtor_test.py @@ -32,9 +32,14 @@ '''Test cases for a class with a private destructor.''' import gc +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import shiboken2 as shiboken from sample import PrivateDtor diff --git a/sources/shiboken2/tests/samplebinding/protected_test.py b/sources/shiboken2/tests/samplebinding/protected_test.py index d343405ad..0cfc69b12 100644 --- a/sources/shiboken2/tests/samplebinding/protected_test.py +++ b/sources/shiboken2/tests/samplebinding/protected_test.py @@ -31,8 +31,14 @@ '''Test cases for protected methods.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import cacheSize from sample import ProtectedNonPolymorphic, ProtectedVirtualDestructor from sample import ProtectedPolymorphic, ProtectedPolymorphicDaughter, ProtectedPolymorphicGrandDaughter diff --git a/sources/shiboken2/tests/samplebinding/pstrlist_test.py b/sources/shiboken2/tests/samplebinding/pstrlist_test.py index 5ecccd075..04492de33 100644 --- a/sources/shiboken2/tests/samplebinding/pstrlist_test.py +++ b/sources/shiboken2/tests/samplebinding/pstrlist_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import sample class PStrListTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/pystr_test.py b/sources/shiboken2/tests/samplebinding/pystr_test.py index 2aa4da40c..b69cf369e 100644 --- a/sources/shiboken2/tests/samplebinding/pystr_test.py +++ b/sources/shiboken2/tests/samplebinding/pystr_test.py @@ -31,9 +31,14 @@ '''Test cases for definition of __str__ method.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point class PyStrTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/python_thread_test.py b/sources/shiboken2/tests/samplebinding/python_thread_test.py index 2015c8ed3..56b927367 100644 --- a/sources/shiboken2/tests/samplebinding/python_thread_test.py +++ b/sources/shiboken2/tests/samplebinding/python_thread_test.py @@ -30,16 +30,22 @@ '''Tests for using Shiboken-based bindings with python threads''' -import unittest +import logging +import os +from random import random +import sys import threading -import sample import time +import unittest -import logging +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + +import sample #logging.basicConfig(level=logging.DEBUG) -from random import random class Producer(threading.Thread): '''Producer thread''' diff --git a/sources/shiboken2/tests/samplebinding/receive_null_cstring_test.py b/sources/shiboken2/tests/samplebinding/receive_null_cstring_test.py index 68de49376..8023aead0 100644 --- a/sources/shiboken2/tests/samplebinding/receive_null_cstring_test.py +++ b/sources/shiboken2/tests/samplebinding/receive_null_cstring_test.py @@ -31,8 +31,14 @@ '''Test case for a function that could receive a NULL pointer in a '[const] char*' parameter.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import countCharacters class ReceiveNullCStringTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/reference_test.py b/sources/shiboken2/tests/samplebinding/reference_test.py index 152730fad..7ff806692 100644 --- a/sources/shiboken2/tests/samplebinding/reference_test.py +++ b/sources/shiboken2/tests/samplebinding/reference_test.py @@ -31,9 +31,14 @@ '''Test cases for methods that receive references to objects.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class ExtendedReference(Reference): diff --git a/sources/shiboken2/tests/samplebinding/referencetopointer_test.py b/sources/shiboken2/tests/samplebinding/referencetopointer_test.py index 5a02c5943..240719e4b 100644 --- a/sources/shiboken2/tests/samplebinding/referencetopointer_test.py +++ b/sources/shiboken2/tests/samplebinding/referencetopointer_test.py @@ -31,8 +31,14 @@ '''Test cases for a reference to pointer argument type.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import VirtualMethods, Str class ExtendedVirtualMethods(VirtualMethods): diff --git a/sources/shiboken2/tests/samplebinding/return_null_test.py b/sources/shiboken2/tests/samplebinding/return_null_test.py index 15abb8b02..85764679b 100644 --- a/sources/shiboken2/tests/samplebinding/return_null_test.py +++ b/sources/shiboken2/tests/samplebinding/return_null_test.py @@ -31,9 +31,14 @@ '''Test case for functions that could return a NULL pointer.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import returnNullPrimitivePointer, returnNullValueTypePointer, returnNullObjectTypePointer class ReturnNullTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/richcompare_test.py b/sources/shiboken2/tests/samplebinding/richcompare_test.py index b219addc5..bcda390c3 100644 --- a/sources/shiboken2/tests/samplebinding/richcompare_test.py +++ b/sources/shiboken2/tests/samplebinding/richcompare_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class TestRichCompare(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/sample_test.py b/sources/shiboken2/tests/samplebinding/sample_test.py index 94cf4f5e3..d6cf82f9a 100644 --- a/sources/shiboken2/tests/samplebinding/sample_test.py +++ b/sources/shiboken2/tests/samplebinding/sample_test.py @@ -31,8 +31,14 @@ '''Test cases for libsample bindings module''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample class ModuleTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/simplefile_test.py b/sources/shiboken2/tests/samplebinding/simplefile_test.py index 2a42942f7..4a841be80 100644 --- a/sources/shiboken2/tests/samplebinding/simplefile_test.py +++ b/sources/shiboken2/tests/samplebinding/simplefile_test.py @@ -32,8 +32,13 @@ '''Test cases for SimpleFile class''' import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import SimpleFile class SimpleFileTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/size_test.py b/sources/shiboken2/tests/samplebinding/size_test.py index b7547d53f..53626c961 100644 --- a/sources/shiboken2/tests/samplebinding/size_test.py +++ b/sources/shiboken2/tests/samplebinding/size_test.py @@ -31,8 +31,14 @@ '''Test cases for operator overloads on Size class''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Size class PointTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/static_nonstatic_methods_test.py b/sources/shiboken2/tests/samplebinding/static_nonstatic_methods_test.py index 9b5c1e029..cd1a8a4f0 100644 --- a/sources/shiboken2/tests/samplebinding/static_nonstatic_methods_test.py +++ b/sources/shiboken2/tests/samplebinding/static_nonstatic_methods_test.py @@ -32,8 +32,13 @@ '''Test cases for overloads involving static and non-static versions of a method.''' import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import SimpleFile class SimpleFile2 (SimpleFile): diff --git a/sources/shiboken2/tests/samplebinding/str_test.py b/sources/shiboken2/tests/samplebinding/str_test.py index a5ead4783..15df1f55a 100644 --- a/sources/shiboken2/tests/samplebinding/str_test.py +++ b/sources/shiboken2/tests/samplebinding/str_test.py @@ -31,8 +31,14 @@ '''Test cases for a method that receives a reference to class that is implicitly convertible from a Python native type.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Str class StrTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/strlist_test.py b/sources/shiboken2/tests/samplebinding/strlist_test.py index 787374b73..57537f061 100644 --- a/sources/shiboken2/tests/samplebinding/strlist_test.py +++ b/sources/shiboken2/tests/samplebinding/strlist_test.py @@ -31,8 +31,14 @@ '''Test cases for StrList class that inherits from std::list.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Str, StrList class StrListTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/templateinheritingclass_test.py b/sources/shiboken2/tests/samplebinding/templateinheritingclass_test.py index 914a3e28e..bc66b208f 100644 --- a/sources/shiboken2/tests/samplebinding/templateinheritingclass_test.py +++ b/sources/shiboken2/tests/samplebinding/templateinheritingclass_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Photon '''This tests classes that inherit from template classes, diff --git a/sources/shiboken2/tests/samplebinding/time_test.py b/sources/shiboken2/tests/samplebinding/time_test.py index 1882ffc5c..f8b35e7b7 100644 --- a/sources/shiboken2/tests/samplebinding/time_test.py +++ b/sources/shiboken2/tests/samplebinding/time_test.py @@ -31,8 +31,14 @@ '''Test cases for constructor and method signature decisor on Time class.''' +import sys +import os import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() import datetime from sample import Time, ImplicitConv, ObjectType diff --git a/sources/shiboken2/tests/samplebinding/transform_test.py b/sources/shiboken2/tests/samplebinding/transform_test.py index 51839dbf0..5369ec466 100644 --- a/sources/shiboken2/tests/samplebinding/transform_test.py +++ b/sources/shiboken2/tests/samplebinding/transform_test.py @@ -31,8 +31,14 @@ '''Test cases for argument modification with more than nine arguments.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point, applyHomogeneousTransform class TransformTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/typeconverters_test.py b/sources/shiboken2/tests/samplebinding/typeconverters_test.py index 46e2dd57c..33f3b62e5 100644 --- a/sources/shiboken2/tests/samplebinding/typeconverters_test.py +++ b/sources/shiboken2/tests/samplebinding/typeconverters_test.py @@ -31,7 +31,14 @@ '''Tests various usages of the type converters.''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + import sample class GetPythonTypeByNameTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/typedealloc_test.py b/sources/shiboken2/tests/samplebinding/typedealloc_test.py index 8f0371d16..b79b6de0e 100644 --- a/sources/shiboken2/tests/samplebinding/typedealloc_test.py +++ b/sources/shiboken2/tests/samplebinding/typedealloc_test.py @@ -32,8 +32,14 @@ '''Test deallocation of type extended in Python.''' import gc -import weakref +import os +import sys import unittest +import weakref + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import Point diff --git a/sources/shiboken2/tests/samplebinding/typedtordoublefree_test.py b/sources/shiboken2/tests/samplebinding/typedtordoublefree_test.py index e1fbc4406..8cf93866f 100644 --- a/sources/shiboken2/tests/samplebinding/typedtordoublefree_test.py +++ b/sources/shiboken2/tests/samplebinding/typedtordoublefree_test.py @@ -29,7 +29,13 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType class TestTypeDestructorDoubleFree(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/unsafe_parent_test.py b/sources/shiboken2/tests/samplebinding/unsafe_parent_test.py index 9e50dabf6..1387e308c 100644 --- a/sources/shiboken2/tests/samplebinding/unsafe_parent_test.py +++ b/sources/shiboken2/tests/samplebinding/unsafe_parent_test.py @@ -31,9 +31,14 @@ '''Test cases for ...''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import ObjectType class DerivedObjectType(ObjectType): diff --git a/sources/shiboken2/tests/samplebinding/useraddedctor_test.py b/sources/shiboken2/tests/samplebinding/useraddedctor_test.py index 17635259d..f59fb3533 100644 --- a/sources/shiboken2/tests/samplebinding/useraddedctor_test.py +++ b/sources/shiboken2/tests/samplebinding/useraddedctor_test.py @@ -31,7 +31,13 @@ '''Test cases for user added constructors''' +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import * class PointTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/virtualdtor_test.py b/sources/shiboken2/tests/samplebinding/virtualdtor_test.py index 388dc29dc..365d31f59 100644 --- a/sources/shiboken2/tests/samplebinding/virtualdtor_test.py +++ b/sources/shiboken2/tests/samplebinding/virtualdtor_test.py @@ -31,9 +31,14 @@ '''Test cases for virtual destructor.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import VirtualDtor class ExtendedVirtualDtor(VirtualDtor): diff --git a/sources/shiboken2/tests/samplebinding/virtualmethods_test.py b/sources/shiboken2/tests/samplebinding/virtualmethods_test.py index a52ce6bf5..2d3198071 100644 --- a/sources/shiboken2/tests/samplebinding/virtualmethods_test.py +++ b/sources/shiboken2/tests/samplebinding/virtualmethods_test.py @@ -31,9 +31,14 @@ '''Test cases for virtual methods.''' +import os import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * import warnings diff --git a/sources/shiboken2/tests/samplebinding/visibilitychange_test.py b/sources/shiboken2/tests/samplebinding/visibilitychange_test.py index a0ead1fb4..7f723221a 100644 --- a/sources/shiboken2/tests/samplebinding/visibilitychange_test.py +++ b/sources/shiboken2/tests/samplebinding/visibilitychange_test.py @@ -29,8 +29,14 @@ ## ############################################################################# +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import * class VisibilityChangeTest(unittest.TestCase): diff --git a/sources/shiboken2/tests/samplebinding/voidholder_test.py b/sources/shiboken2/tests/samplebinding/voidholder_test.py index 361a3bcdd..07b83347b 100644 --- a/sources/shiboken2/tests/samplebinding/voidholder_test.py +++ b/sources/shiboken2/tests/samplebinding/voidholder_test.py @@ -31,8 +31,14 @@ '''Test case for a class that holds a void pointer.''' +import os +import sys import unittest +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import VoidHolder, Point import shiboken2 as shiboken diff --git a/sources/shiboken2/tests/samplebinding/weakref_test.py b/sources/shiboken2/tests/samplebinding/weakref_test.py index 5379169e1..a4a2dc461 100644 --- a/sources/shiboken2/tests/samplebinding/weakref_test.py +++ b/sources/shiboken2/tests/samplebinding/weakref_test.py @@ -31,8 +31,14 @@ '''Test weakref support''' -import weakref +import os +import sys import unittest +import weakref + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from sample import ObjectType, PrivateDtor diff --git a/sources/shiboken2/tests/samplebinding/writableclassdict_test.py b/sources/shiboken2/tests/samplebinding/writableclassdict_test.py index 003e35e7b..58083b5d4 100644 --- a/sources/shiboken2/tests/samplebinding/writableclassdict_test.py +++ b/sources/shiboken2/tests/samplebinding/writableclassdict_test.py @@ -29,7 +29,14 @@ ## ############################################################################# +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + from sample import Point class ExtPoint(Point): pass diff --git a/sources/shiboken2/tests/shiboken_paths.py b/sources/shiboken2/tests/shiboken_paths.py new file mode 100644 index 000000000..cf366a133 --- /dev/null +++ b/sources/shiboken2/tests/shiboken_paths.py @@ -0,0 +1,74 @@ +############################################################################# +## +## Copyright (C) 2020 The Qt Company Ltd. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of the test suite of Qt for Python. +## +## $QT_BEGIN_LICENSE:GPL-EXCEPT$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 3 as published by the Free Software +## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + + +import os +import sys + + +def _prepend_path_var(var_name, paths): + """Prepend additional paths to a path environment variable + like PATH, LD_LIBRARY_PATH""" + old_paths = os.environ.get(var_name) + new_paths = os.pathsep.join(paths) + if old_paths: + new_paths += '{}{}'.format(os.pathsep, old_paths) + os.environ[var_name] = new_paths + + +def init_paths(): + """Sets the correct import paths (Python modules and C++ library + paths) for testing shiboken depending on a single + environment variable BUILD_DIR pointing to the build + directory.""" + VAR_NAME = 'BUILD_DIR' + build_dir = os.environ.get(VAR_NAME) + if not build_dir: + raise ValueError('{} is not set!'.format(VAR_NAME)) + if not os.path.isdir(build_dir): + raise ValueError('{} is not a directory!'.format(build_dir)) + src_dir = os.path.dirname(os.path.abspath(__file__)) + if src_dir not in sys.path: # Might be present due to import of this file + sys.path.append(src_dir) # For py3kcompat + shiboken_dir = os.path.join(build_dir, 'shiboken2') + sys.path.append(os.path.join(shiboken_dir, 'shibokenmodule')) + lib_dirs = [os.path.join(shiboken_dir, 'libshiboken')] + shiboken_test_dir = os.path.join(shiboken_dir, 'tests') + for module in ['minimal', 'sample', 'smart', 'other']: + module_dir = os.path.join(shiboken_test_dir, module + 'binding') + sys.path.append(module_dir) + lib_dir = os.path.join(shiboken_test_dir, 'lib' + module) + lib_dirs.append(lib_dir) + if sys.platform == 'win32': + if sys.version_info >= (3, 8, 0): + for lib_dir in lib_dirs: + os.add_dll_directory(lib_dir) + else: + _prepend_path_var('PATH', lib_dirs) + else: + _prepend_path_var('LD_LIBRARY_PATH', lib_dirs) diff --git a/sources/shiboken2/tests/shibokenmodule/module_test.py b/sources/shiboken2/tests/shibokenmodule/module_test.py index 54a175588..d0a8e6bf5 100644 --- a/sources/shiboken2/tests/shibokenmodule/module_test.py +++ b/sources/shiboken2/tests/shibokenmodule/module_test.py @@ -26,8 +26,15 @@ ## ############################################################################# -import shiboken2 as shiboken +import os +import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() + +import shiboken2 as shiboken from sample import * class MultipleInherited (ObjectType, Point): diff --git a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py index b26a3dcbc..94f20c800 100644 --- a/sources/shiboken2/tests/smartbinding/smart_pointer_test.py +++ b/sources/shiboken2/tests/smartbinding/smart_pointer_test.py @@ -32,8 +32,13 @@ from __future__ import print_function import gc +import os import sys import unittest + +sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from shiboken_paths import init_paths +init_paths() from copy import copy from smart import Obj, Registry, Integer -- cgit v1.2.3 From 93daae0beea09c8d745d691889838ed816c23eba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simo=20F=C3=A4lt?= Date: Fri, 31 Jan 2020 10:41:09 +0200 Subject: Bump versions strings Change-Id: I4ed952681abe6f42ff43a567f70fdc7e6512ddcc Reviewed-by: Friedemann Kleint --- sources/shiboken2/shiboken_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/shiboken_version.py b/sources/shiboken2/shiboken_version.py index 78ea0019d..0e0943143 100644 --- a/sources/shiboken2/shiboken_version.py +++ b/sources/shiboken2/shiboken_version.py @@ -39,7 +39,7 @@ major_version = "5" minor_version = "14" -patch_version = "0" +patch_version = "2" # For example: "a", "b", "rc" # (which means "alpha", "beta", "release candidate"). -- cgit v1.2.3 From 22e359bc19daf19033332aa2d7bb9726c7f4be14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=C3=A1n=20Maureira-Fredes?= Date: Mon, 17 Feb 2020 13:41:08 +0100 Subject: shiboken: Improve the libdir for windows With virtualenv 20 we have the case where the first path in the PYTHON_LIBRARIES cmake variable was wrong: a_virtual_env/libs/python3.lib so the python code inside the helper didn't have a proper check if the file was valid or it was just a wrong construct. Additionally, the 'prefix' variable will contain the virtual environment directory location, which will not contain the 'libs' directory, because that's included in the system's installation path. To solve this, we use the 'INCLUDEPY' directory, which is correct as a base to create the real 'libs' one. Task-number: PYSIDE-1231 Change-Id: Ifca08d74c49cd57572836a087edb96c089266dc7 Reviewed-by: Friedemann Kleint --- sources/shiboken2/data/shiboken_helpers.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/data/shiboken_helpers.cmake b/sources/shiboken2/data/shiboken_helpers.cmake index 9772ee597..ee6c6c4d5 100644 --- a/sources/shiboken2/data/shiboken_helpers.cmake +++ b/sources/shiboken2/data/shiboken_helpers.cmake @@ -287,8 +287,9 @@ macro(shiboken_check_if_limited_api) # On other platforms, this result is not used at all. execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "if True: + import os for lib in '${PYTHON_LIBRARIES}'.split(';'): - if '/' in lib: + if '/' in lib and os.path.isfile(lib): prefix, py = lib.rsplit('/', 1) if py.startswith('python3'): print(prefix + '/python3.lib') -- cgit v1.2.3 From eaaba5fa6a0920f06783915d0ba9b4661023bbc1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 14 Feb 2020 15:46:56 +0100 Subject: shiboken: Handle typedef'ed enums Treat "typedef enum {} Name" as "enum Name". Clang actually provides type information for these cases, use it (taking care not to break real anonynous enumerations) and skip the repetitive definition of the elaborated type. Fixes: PYSIDE-1228 Change-Id: Icaf0450f3fea3ba9f06737e351b56e6e5df0749a Reviewed-by: Cristian Maureira-Fredes --- .../ApiExtractor/clangparser/clangbuilder.cpp | 36 +++++++++++++++++----- sources/shiboken2/ApiExtractor/tests/testenum.cpp | 1 - 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index a5b153499..d52e4672b 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -190,7 +190,7 @@ public: TypeInfo *t) const; bool addTemplateInstantiationsRecursion(const CXType &type, TypeInfo *t) const; - void addTypeDef(const CXCursor &cursor, const TypeInfo &ti); + void addTypeDef(const CXCursor &cursor, const CXType &cxType); TemplateParameterModelItem createTemplateParameter(const CXCursor &cursor) const; TemplateParameterModelItem createNonTypeTemplateParameter(const CXCursor &cursor) const; @@ -539,11 +539,12 @@ TypeInfo BuilderPrivate::createTypeInfo(const CXType &type) const return it.value(); } -void BuilderPrivate::addTypeDef(const CXCursor &cursor, const TypeInfo &ti) +void BuilderPrivate::addTypeDef(const CXCursor &cursor, const CXType &cxType) { - TypeDefModelItem item(new _TypeDefModelItem(m_model, getCursorSpelling(cursor))); + const QString target = getCursorSpelling(cursor); + TypeDefModelItem item(new _TypeDefModelItem(m_model, target)); setFileName(cursor, item.data()); - item->setType(ti); + item->setType(createTypeInfo(cxType)); item->setScope(m_scope); m_scopeStack.back()->addTypeDef(item); m_cursorTypedefHash.insert(cursor, item); @@ -765,6 +766,19 @@ static CodeModel::ClassType codeModelClassTypeFromCursor(CXCursorKind kind) return result; } +static QString enumType(const CXCursor &cursor) +{ + QString name = getCursorSpelling(cursor); // "enum Foo { v1, v2 };" + if (name.isEmpty()) { + // PYSIDE-1228: For "typedef enum { v1, v2 } Foo;", type will return + // "Foo" as expected. Care must be taken to exclude real anonymous enums. + name = getTypeName(clang_getCursorType(cursor)); + if (name.contains(QLatin1String("(anonymous"))) + name.clear(); + } + return name; +} + BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) { switch (cursor.kind) { @@ -807,7 +821,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) d->m_scope.back() += templateBrackets(); break; case CXCursor_EnumDecl: { - QString name = getCursorSpelling(cursor); + QString name = enumType(cursor); EnumKind kind = CEnum; if (name.isEmpty()) { kind = AnonymousEnum; @@ -953,11 +967,17 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor) case CXCursor_TypeAliasTemplateDecl: { // May contain nested CXCursor_TemplateTypeParameter const CXType type = clang_getCanonicalType(clang_getCursorType(cursor)); if (type.kind > CXType_Unexposed) - d->addTypeDef(cursor, d->createTypeInfo(type)); + d->addTypeDef(cursor, type); } return Skip; - case CXCursor_TypedefDecl: - d->addTypeDef(cursor, d->createTypeInfo(clang_getTypedefDeclUnderlyingType(cursor))); + case CXCursor_TypedefDecl: { + auto underlyingType = clang_getTypedefDeclUnderlyingType(cursor); + d->addTypeDef(cursor, underlyingType); + // For "typedef enum/struct {} Foo;", skip the enum/struct + // definition nested into the typedef (PYSIDE-1228). + if (underlyingType.kind == CXType_Elaborated) + return Skip; + } break; case CXCursor_TypeRef: if (!d->m_currentFunction.isNull()) { diff --git a/sources/shiboken2/ApiExtractor/tests/testenum.cpp b/sources/shiboken2/ApiExtractor/tests/testenum.cpp index ebdcf8d81..c04a37d9d 100644 --- a/sources/shiboken2/ApiExtractor/tests/testenum.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testenum.cpp @@ -416,7 +416,6 @@ void TestEnum::testTypedefEnum() QVERIFY(!builder.isNull()); AbstractMetaEnumList globalEnums = builder->globalEnums(); - QEXPECT_FAIL("", "APIExtractor does not handle typedef enum correctly yet", Abort); QCOMPARE(globalEnums.count(), 1); AbstractMetaEnum* enumA = globalEnums.first(); -- cgit v1.2.3