On Apr 28, 6:37 am, Bart <[EMAIL PROTECTED]> wrote: > Hi everyone! > > Im using module that gives errors to stderr/stdout (generated by SWIG) > Problem is that I need to parse this errors/information from module. > > os.popen3 looks nice but this executes command not function. > > Is there any solution? >
Perhaps you're looking for the unittest module? You can use assertRaises if an exception is raised by the function. You can also redirect sys.stderr and sys.stdout as needed and test the captured strings with assertEquals. Else you can wrap the module under test in another module: # mytest.py import module_under_test if __name__ == "__main__": module_under_test.foo() Then, using os.popen3 (or subprocess), run "python mytest.py" as your command. -- Hope this helps, Steven -- http://mail.python.org/mailman/listinfo/python-list