Ticket #7836: gil_test.cpp

File gil_test.cpp, 757 bytes (added by John Zwinck <jzwinck@…>, 10 years ago)

Test for <boost/python/gil.hpp>

Line 
1#define BOOST_TEST_MODULE boost_python_gil
2#define BOOST_TEST_DYN_LINK
3
4#include <boost/test/unit_test.hpp>
5#include "gil.hpp"
6
7BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
8
9BOOST_AUTO_TEST_CASE(test1)
10{
11 {
12 // test building a guard without Python threads initialized
13 // this isn't a common thing to do, but we do support it "just in case"
14 boost::python::gil_guard_release release1;
15 }
16
17 {
18 Py_InitializeEx(false);
19 boost::python::gil_guard_release release2;
20 boost::python::gil_guard_release release3; // should do nothing
21 boost::python::gil_guard_acquire acquire1; // re-acquires the lock
22 boost::python::gil_guard_acquire acquire2; // should do nothing
23 }
24}
25
26BOOST_AUTO_TEST_SUITE_END()