aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-02-19 10:16:28 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-02-19 10:20:14 +0100
commitd38f930e41fb4b1123bab3a243fd04b3a74281e2 (patch)
tree3ffa0dbc1d7eb18df3ae651187381ab95aa2edf3 /sources/shiboken2
parent02018700e86a7eea18eac2952b819a9b77606d1b (diff)
parenteaaba5fa6a0920f06783915d0ba9b4661023bbc1 (diff)
Merge remote-tracking branch 'origin/5.14' into 5.15
Diffstat (limited to 'sources/shiboken2')
-rw-r--r--sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp36
-rw-r--r--sources/shiboken2/ApiExtractor/tests/testenum.cpp1
-rw-r--r--sources/shiboken2/data/shiboken_helpers.cmake3
-rw-r--r--sources/shiboken2/tests/CMakeLists.txt18
-rw-r--r--sources/shiboken2/tests/minimalbinding/brace_pattern_test.py8
-rw-r--r--sources/shiboken2/tests/minimalbinding/listuser_test.py7
-rw-r--r--sources/shiboken2/tests/minimalbinding/minbool_test.py6
-rw-r--r--sources/shiboken2/tests/minimalbinding/obj_test.py6
-rw-r--r--sources/shiboken2/tests/minimalbinding/typedef_test.py6
-rw-r--r--sources/shiboken2/tests/minimalbinding/val_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/collector_external_operator_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/otherbinding/conversion_operator_for_class_without_implicit_conversions_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/otherbinding/extended_multiply_operator_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/module_reload_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/otherbinding/new_ctor_operator_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/objtypehashes_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/otherderived_test.py5
-rw-r--r--sources/shiboken2/tests/otherbinding/signature_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/typediscovery_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/otherbinding/usersprimitivefromothermodule_test.py6
-rw-r--r--sources/shiboken2/tests/otherbinding/wrongctor_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/__del___test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/abstract_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/addedfunction_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/addedfunction_with_container_args_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/argumentmodifications_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/array_numpy_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/array_sequence_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/bug_554_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/bug_704_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/bytearray_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/child_return_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/class_fields_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/collector_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/complex_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/conversion_operator_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/copy_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ctorconvrule_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/cyclic_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/date_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/decisor_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/delete_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/deprecated_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/derived_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/duck_punching_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/echo_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/enum_test.py4
-rw-r--r--sources/shiboken2/tests/samplebinding/enumfromremovednamespace_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/event_loop_call_virtual_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/event_loop_thread_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/exception_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/filter_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/handleholder_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/hashabletype_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ignorederefop_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/implicitconv_numerical_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/implicitconv_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/samplebinding/inheritanceandscope_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/injectcode_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/innerclass_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/intlist_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/invalid_virtual_return_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/keep_reference_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/list_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/lock_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/map_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/metaclass_test.py9
-rw-r--r--sources/shiboken2/tests/samplebinding/mi_virtual_methods_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/mixed_mi_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/modelindex_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/modelview_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/modifications_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/modified_constructor_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/modifiedvirtualmethods_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/multi_cpp_inheritance_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/multiple_derived_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/namespace_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/newdivision_test.py10
-rw-r--r--sources/shiboken2/tests/samplebinding/nondefaultctor_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/nontypetemplate_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/nonzero_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/numericaltypedef_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/numpy_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttype_test.py6
-rw-r--r--[-rwxr-xr-x]sources/shiboken2/tests/samplebinding/objecttype_with_named_args_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttypebyvalue_test.py10
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttypelayout_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttypeoperators_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/objecttypereferenceasvirtualmethodargument_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/oddbool_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/oldstyleclass_as_number_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/onlycopyclass_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/overflow_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/overload_sorting_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/overload_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/overloadwithdefault_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_argument_invalidation_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_delete_child_in_cpp_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_delete_child_in_python_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_delete_parent_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_invalidate_after_use_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_invalidate_child_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_invalidate_nonpolymorphic_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_invalidate_parent_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_reparenting_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/ownership_transference_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/pair_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/pen_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/point_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/pointerholder_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/pointerprimitivetype_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/pointf_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/primitivereferenceargument_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/privatector_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/privatedtor_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/protected_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/pstrlist_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/pystr_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/python_thread_test.py14
-rw-r--r--sources/shiboken2/tests/samplebinding/receive_null_cstring_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/reference_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/referencetopointer_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/renaming_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/return_null_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/richcompare_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/sample_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/simplefile_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/size_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/static_nonstatic_methods_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/str_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/strlist_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/templateinheritingclass_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/time_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/transform_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/typeconverters_test.py7
-rw-r--r--sources/shiboken2/tests/samplebinding/typedealloc_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/typedtordoublefree_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/unsafe_parent_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/useraddedctor_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/virtualdtor_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/virtualmethods_test.py5
-rw-r--r--sources/shiboken2/tests/samplebinding/visibilitychange_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/voidholder_test.py6
-rw-r--r--sources/shiboken2/tests/samplebinding/weakref_test.py8
-rw-r--r--sources/shiboken2/tests/samplebinding/writableclassdict_test.py7
-rw-r--r--sources/shiboken2/tests/shiboken_paths.py74
-rw-r--r--sources/shiboken2/tests/shibokenmodule/module_test.py9
-rw-r--r--sources/shiboken2/tests/smartbinding/smart_pointer_test.py5
148 files changed, 961 insertions, 42 deletions
diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp
index 78f34c87f..7c188535f 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;
@@ -540,11 +540,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);
@@ -788,6 +789,19 @@ static NamespaceType namespaceType(const CXCursor &cursor)
return NamespaceType::Default;
}
+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) {
@@ -830,7 +844,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;
@@ -980,11 +994,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();
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')
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
index 2aba4bd09..1e992ebc8 100755..100644
--- 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
index 0c58fbf5b..5ad4763b7 100755..100644
--- 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
index 09988496a..84dfe9839 100755..100644
--- 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/signature_test.py b/sources/shiboken2/tests/otherbinding/signature_test.py
index e9fcff860..06894eaf8 100644
--- a/sources/shiboken2/tests/otherbinding/signature_test.py
+++ b/sources/shiboken2/tests/otherbinding/signature_test.py
@@ -31,8 +31,14 @@
'''Test cases for functions signature'''
+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 OtherObjectType
from helper import objectFullname
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
index fe13cf601..a69ee23f0 100755..100644
--- 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 <add-function> 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
index 892a2bc93..6b8a91573 100755..100644
--- 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
@@ -32,8 +32,14 @@
'''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 67f0974a7..b1977cf6f 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 *
from helper import objectFullname
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
index 846ae5108..ce7874c23 100755..100644
--- 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 <add-function> 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/renaming_test.py b/sources/shiboken2/tests/samplebinding/renaming_test.py
index 1fe42578d..cb59dce3a 100644
--- a/sources/shiboken2/tests/samplebinding/renaming_test.py
+++ b/sources/shiboken2/tests/samplebinding/renaming_test.py
@@ -31,9 +31,15 @@
'''Test cases for renaming using target-lang-name attribute.'''
+import os
import re
+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 RenamedValue, RenamedUser
class RenamingTest(unittest.TestCase):
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<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, 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
@@ -32,7 +32,13 @@
'''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 06df80d54..e0b217a8b 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