How to use the cppimport.build_module.stdchannel_redirected function in cppimport

To help you get started, we’ve selected a few cppimport examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tbenthompson / cppimport / tests / test_cppimport.py View on Github external
def test_redirected_stream():
    sys.stderr = io.StringIO()
    with cppimport.build_module.stdchannel_redirected("stdout") as s:
        with cppimport.build_module.stdchannel_redirected("stderr"):
            print("EEEP!")
    assert(s.getvalue() == 'EEEP!\n')
github tbenthompson / cppimport / tests / test_cppimport.py View on Github external
def test_redirected_stream():
    sys.stderr = io.StringIO()
    with cppimport.build_module.stdchannel_redirected("stdout") as s:
        with cppimport.build_module.stdchannel_redirected("stderr"):
            print("EEEP!")
    assert(s.getvalue() == 'EEEP!\n')