I am creating a unittest and I want to test the output of a method. My code is kinda big so I will use a little example. Let's say my method looks like this.
def foo():
print "hello"
Now I go to my unittest class and I run the code in the unittest like this.
def test_code():
firstClass.foo()
I want to test the output I get from the console. I saw some people using subprocess
but there I can only give arguments. So my question is how could I get the output from the console to test it in my unittest class.