
Predict
Who Runs First?
print inside tests goes to normal output (not the runner's stream).
Think about when setUp runs and in what order tests run.
import io, unittest
class TestOrder(unittest.TestCase):
def setUp(self):
print("setup", end=" ")
def test_zebra(self):
print("Z", end=" ")
def test_apple(self):
print("A", end=" ")
suite = unittest.TestLoader().loadTestsFromTestCase(TestOrder)
unittest.TextTestRunner(stream=io.StringIO()).run(suite)