Update of /cvsroot/boost/boost/libs/python/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv14018/libs/python/test
Modified Files:
Tag: RC_1_34_0
import_.cpp Jamfile.v2
Log Message:
libs/python/build/Jamfile.v2: remove needless <define> property.
libs/python/test/Jamfile.v2:
* add dynamically-linked embedding test
* fix builtin_converters test so it can work (BBv1 allowed the
duplication of main target names; BBv2 does not)
libs/python/test/import_.cpp: move some more of the Python code within
a handle_exception callback so at least we can better diagnose
failures.
Index: import_.cpp
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/test/import_.cpp,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- import_.cpp 5 Mar 2007 18:44:45 -0000 1.1.2.2
+++ import_.cpp 17 Mar 2007 20:17:56 -0000 1.1.2.3
@@ -4,16 +4,29 @@
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/python.hpp>
-
+#include <boost/bind.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <sstream>
namespace bpl = boost::python;
-void import_test()
+void import_test( char** argv )
{
// Retrieve the main module
+ bpl::object main = bpl::import("__main__");
+
+ // Retrieve the main module's namespace
+ bpl::object global(main.attr("__dict__"));
+
+ // Inject search path for import_ module
+ std::ostringstream script;
+ script << "import sys, os\n"
+ << "path = os.path.dirname('" << argv[1] << "')\n"
+ << "sys.path.insert(0, path)\n";
+ bpl::exec(bpl::str(script.str()), global, global);
+
+ // Retrieve the main module
bpl::object import_ = bpl::import("import_");
int value = bpl::extract<int>(import_.attr("value"))
BOOST_EXTRACT_WORKAROUND;
std::cout << value << std::endl;
@@ -27,19 +40,7 @@
// Initialize the interpreter
Py_Initialize();
- // Retrieve the main module
- bpl::object main = bpl::import("__main__");
-
- // Retrieve the main module's namespace
- bpl::object global(main.attr("__dict__"));
-
- // Inject search path for import_ module
- std::ostringstream script;
- script << "import sys, os.path\n"
- << "path = os.path.dirname('" << argv[1] << "')\n"
- << "sys.path.insert(0, path)\n";
- bpl::object result = bpl::exec(bpl::str(script.str()), global, global);
- if (bpl::handle_exception(import_test))
+ if (bpl::handle_exception(boost::bind(import_test, argv)))
{
if (PyErr_Occurred())
{
Index: Jamfile.v2
===================================================================
RCS file: /cvsroot/boost/boost/libs/python/test/Jamfile.v2,v
retrieving revision 1.13.2.11
retrieving revision 1.13.2.12
diff -u -d -r1.13.2.11 -r1.13.2.12
--- Jamfile.v2 5 Mar 2007 18:44:45 -0000 1.13.2.11
+++ Jamfile.v2 17 Mar 2007 20:17:56 -0000 1.13.2.12
@@ -27,23 +27,23 @@
}
-
-#template py-unit-test
-# :
-# : $(PYTHON_PROPERTIES) <define>BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION
-# [ difference $(PYTHON_PROPERTIES) : <define>BOOST_PYTHON_DYNAMIC_LIB ]
<define>BOOST_PYTHON_STATIC_LIB
-# ;
-
-
test-suite python
:
[
run exec.cpp ../build//boost_python/<link>static /python//python
: # program args
+ : exec.py # input files
+ : # requirements
+ : # target-name
+ ]
+
+ [
+ run exec.cpp ../build//boost_python/<link>shared /python//python
+ : # program args
: exec.py
: # requirements
- <define>BOOST_PYTHON_STATIC_MODULE
+ : exec-dynamic # target-name
]
[
@@ -77,8 +77,8 @@
[ bpl-test keywords : keywords.cpp keywords_test.py ]
-[ python-extension builtin_converters.ext : test_builtin_converters.cpp
/boost/python//boost_python ]
-[ bpl-test builtin_converters : test_builtin_converters.py
builtin_converters.ext ]
+[ python-extension builtin_converters_ext : test_builtin_converters.cpp
/boost/python//boost_python ]
+[ bpl-test builtin_converters : test_builtin_converters.py
builtin_converters_ext ]
[ bpl-test test_pointer_adoption ]
[ bpl-test operators ]
@@ -144,7 +144,7 @@
# Whenever the cause for the failure of the polymorphism test is found
# and fixed, this should be retested.
<toolset>hp_cxx:<build>no ]
-
+
[ python-extension map_indexing_suite_ext
: map_indexing_suite.cpp int_map_indexing_suite.cpp
/boost/python//boost_python ]
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs