How to efficient make unittests?

A slight improvement to run_tests:

import sys
import unittest
import anvil.server

test_modules = ['test_module_1', 'test_module_2']

@anvil.server.callable
def run_tests(verbosity=0):
  test = unittest.TestLoader().loadTestsFromNames(test_modules)
  unittest.TextTestRunner(stream=sys.stdout, verbosity=verbosity).run(test)

The default verbosity level is minimal output. Increase the number to see more.

4 Likes