Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def main(test_module, exit = None, buffer = None):
import green.loader, green.runner
if buffer:
green_args.quiet_stdout = True
try:
suite = green.loader.GreenTestLoader().loadTestsFromModule(test_module) # new API (v2.9+)
except AttributeError:
suite = green.loader.loadFromModule(test_module) # legacy API
results = green.runner.run(suite, sys.stdout, green_args)
# Return the results in an object with a "result" attribute, same as unittest.main()
return collections.namedtuple("Tuple", "result")(results)