Python gets individual testing time

I have some unit tests written using the built-in module unittest

for Python 3. This is the way I am calling them:

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(TestUser)
    unittest.TextTestRunner(verbosity=2).run(suite)

      

At the end of the test for the class, it gives the total time for how long it took to move through the entire process. I have two problems:

  • The my function setUp()

    takes a few seconds and I don't want to count this time
  • I'd rather get a quick overview of the time each individual test passed (not all tests in the class)

Is this possible with this module?

+3


source to share





All Articles