
Simon Pickles
Simon Pickles wrote:
Simon Pickles wrote:
Hi
I am using the Unit Test Framework to test my use of boost.python. I am using a global fixture to initialize the python intepreter a single time (rather than before each test).
My problem is I would like to use the Python initialising class in my tests, and I can't figure out how to do this. I don't want to use normal fixtures since each test would call initialize the interpreter, causing problems.
Boost.Test does not provide means to do this directly. You can alsays mimic some kind of singleton though: struct GlobalFixure { GlobalFixure*& instance() { static GlobalFixure* s_inst = 0; return s_inst; } GlobalFixure() { instance() = this; ... } }; ... GlobalFixure::instance().m_member.do_something(); ################# Is this approach used as a global fixture or a test fixture? Thanks Simon