How to use the green.loader.loadFromModule function in green

To help you get started, we’ve selected a few green examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gurnec / btcrecover / run-all-tests.py View on Github external
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)