aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2011-09-16 14:29:25 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2012-03-08 16:17:14 -0300
commit4e17f2620f10677e09b9cb93c7ba8efa703b158b (patch)
tree7ffe0300a6c3166ebf0dca76c7ff9876ef9cbedc /tests
parentc686942f6efbac4ac43cf859bfdd2c7209b783ea (diff)
Revert "Implements PSEP-0106 and fixes bug 902 - "Expose Shiboken functionality through a Python module"."
This reverts commit bc8448d7fb91733ff08c2a6a3a878702c14a24e0. The PSEP didn't reach the final version yet, so this commit can't be released.
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt12
-rw-r--r--tests/libsample/objecttype.cpp6
-rw-r--r--tests/libsample/objecttype.h1
-rw-r--r--tests/samplebinding/typesystem_sample.xml6
-rw-r--r--tests/shibokenmodule/module_test.py70
5 files changed, 6 insertions, 89 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1c728dd9..6d8e4148 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -23,8 +23,7 @@ if(DEFINED MINIMAL_TESTS)
else()
file(GLOB TEST_FILES minimalbinding/*_test.py
samplebinding/*_test.py
- otherbinding/*_test.py
- shibokenmodule/*_test.py)
+ otherbinding/*_test.py)
endif()
list(SORT TEST_FILES)
@@ -39,7 +38,7 @@ if(CMAKE_VERSION VERSION_LESS 2.8)
message("CMake version greater than 2.8 necessary to run tests")
else()
if(WIN32)
- set(TEST_PYTHONPATH "${minimal_BINARY_DIR};${sample_BINARY_DIR};${other_BINARY_DIR};${shibokenmodule_BINARY_DIR}")
+ set(TEST_PYTHONPATH "${minimal_BINARY_DIR};${sample_BINARY_DIR};${other_BINARY_DIR}")
set(TEST_LIBRARY_PATH "$ENV{PATH};${libminimal_BINARY_DIR};${libsample_BINARY_DIR};${libother_BINARY_DIR};${libshiboken_BINARY_DIR}")
set(LIBRARY_PATH_VAR "PATH")
string(REPLACE "\\" "/" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
@@ -47,13 +46,14 @@ else()
string(REPLACE ";" "\\;" TEST_PYTHONPATH "${TEST_PYTHONPATH}")
string(REPLACE ";" "\\;" TEST_LIBRARY_PATH "${TEST_LIBRARY_PATH}")
else()
- set(TEST_PYTHONPATH "${minimal_BINARY_DIR}:${sample_BINARY_DIR}:${other_BINARY_DIR}:${shibokenmodule_BINARY_DIR}")
+ set(TEST_PYTHONPATH "${minimal_BINARY_DIR}:${sample_BINARY_DIR}:${other_BINARY_DIR}")
set(TEST_LIBRARY_PATH "$ENV{LD_LIBRARY_PATH}:${libminimal_BINARY_DIR}:${libsample_BINARY_DIR}:${libother_BINARY_DIR}:${libshiboken_BINARY_DIR}")
set(LIBRARY_PATH_VAR "LD_LIBRARY_PATH")
endif()
+
foreach(test_file ${TEST_FILES})
- string(REGEX MATCH "/([^/]+)(binding|module)/([^/]+)_test.py" tmp ${test_file})
- set(test_name "${CMAKE_MATCH_1}_${CMAKE_MATCH_3}")
+ string(REGEX MATCH "/([^/]+)binding/([^/]+)_test.py" tmp ${test_file})
+ set(test_name "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}")
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}")
diff --git a/tests/libsample/objecttype.cpp b/tests/libsample/objecttype.cpp
index c253c610..e4fce71e 100644
--- a/tests/libsample/objecttype.cpp
+++ b/tests/libsample/objecttype.cpp
@@ -283,9 +283,3 @@ ObjectType* ObjectType::createChild(ObjectType* parent)
{
return new ObjectType(parent);
}
-
-std::size_t ObjectType::createObjectType()
-{
- void* addr = new ObjectType();
- return (std::size_t) addr;
-}
diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h
index 84812a8d..f032a09f 100644
--- a/tests/libsample/objecttype.h
+++ b/tests/libsample/objecttype.h
@@ -106,7 +106,6 @@ public:
virtual bool isPython() { return false; }
void callVirtualCreateChild();
virtual ObjectType* createChild(ObjectType* parent);
- static std::size_t createObjectType();
//return a parent from C++
ObjectType* getCppParent() {
diff --git a/tests/samplebinding/typesystem_sample.xml b/tests/samplebinding/typesystem_sample.xml
index 09de7b94..2fef355f 100644
--- a/tests/samplebinding/typesystem_sample.xml
+++ b/tests/samplebinding/typesystem_sample.xml
@@ -16,7 +16,6 @@
<primitive-type name="unsigned char"/>
<primitive-type name="long"/>
<primitive-type name="unsigned long"/>
- <primitive-type name="std::size_t" target-lang-api-name="PyLong"/>
<primitive-type name="std::string"/>
<primitive-type name="Complex" target-lang-api-name="PyComplex">
@@ -304,11 +303,6 @@
</object-type>
<object-type name="ObjectView">
- <modify-function signature="ObjectView(ObjectModel*, ObjectType*)">
- <modify-argument index="1">
- <reference-count action="set" variable-name="setModel(ObjectModel*)1"/>
- </modify-argument>
- </modify-function>
<modify-function signature="setModel(ObjectModel*)">
<modify-argument index="1">
<reference-count action="set"/>
diff --git a/tests/shibokenmodule/module_test.py b/tests/shibokenmodule/module_test.py
deleted file mode 100644
index 565e985a..00000000
--- a/tests/shibokenmodule/module_test.py
+++ /dev/null
@@ -1,70 +0,0 @@
-import shiboken
-import unittest
-from sample import *
-
-class MultipleInherited (ObjectType, Point):
- def __init__(self):
- ObjectType.__init__(self)
- Point.__init__(self)
-
-class TestShiboken(unittest.TestCase):
- def testIsValid(self):
- self.assertTrue(shiboken.isValid(object()))
- self.assertTrue(shiboken.isValid(None))
-
- bb = BlackBox()
- item = ObjectType()
- ticket = bb.keepObjectType(item)
- bb.disposeObjectType(ticket)
- self.assertFalse(shiboken.isValid(item))
-
- def testWrapInstance(self):
- addr = ObjectType.createObjectType()
- obj = shiboken.wrapInstance(addr, ObjectType)
- self.assertFalse(shiboken.wasCreatedByPython(obj))
- obj.setObjectName("obj")
- self.assertEqual(obj.objectName(), "obj")
- self.assertEqual(addr, obj.identifier())
- self.assertFalse(shiboken.wasCreatedByPython(obj))
-
- # avoid mem leak =]
- bb = BlackBox()
- self.assertTrue(shiboken.wasCreatedByPython(bb))
- bb.disposeObjectType(bb.keepObjectType(obj))
-
- def testIsOwnedByPython(self):
- obj = ObjectType()
- self.assertTrue(shiboken.isOwnedByPython(obj))
- p = ObjectType()
- obj.setParent(p)
- self.assertFalse(shiboken.isOwnedByPython(obj))
-
- def testDump(self):
- """Just check if dump doesn't crash on certain use cases"""
- p = ObjectType()
- obj = ObjectType(p)
- obj2 = ObjectType(obj)
- obj3 = ObjectType(obj)
- self.assertEqual(shiboken.dump(None), "Ordinary Python type.")
- shiboken.dump(obj)
-
- model = ObjectModel(p)
- v = ObjectView(model, p)
- shiboken.dump(v)
-
- m = MultipleInherited()
- shiboken.dump(m)
- self.assertEqual(len(shiboken.getCppPointer(m)), 2)
-
- def testDelete(self):
- obj = ObjectType()
- child = ObjectType(obj)
- self.assertTrue(shiboken.isValid(obj))
- self.assertTrue(shiboken.isValid(child))
- # Note: this test doesn't assure that the object dtor was really called
- shiboken.delete(obj)
- self.assertFalse(shiboken.isValid(obj))
- self.assertFalse(shiboken.isValid(child))
-
-if __name__ == '__main__':
- unittest.main()