

def discover(what):
    "Given a string module path, drill into it for its TestCases.\n\n    This will descend recursively into packages and lists, so the following are valid:\n        - add_test_module('tests.biz_cmds.biz_ad_test')\n        - add_test_module('tests.biz_cmds.biz_ad_test.tests')\n        - add_test_module('tests.biz_cmds')\n        - add_test_module('tests')\n    "
    try:
        what = to_module(what)
        mod = __import__(what, fromlist=[str('__trash')])
        discovered = set()
        if hasattr(mod, '__path__'):
            for (_, module_name, _) in pkgutil.walk_packages(mod.__path__, prefix=(mod.__name__ + '.')):
                mod = __import__(module_name, fromlist=[str('__trash')])
                discovered.update(get_test_classes_from_module(mod))
        else:
            discovered.update(get_test_classes_from_module(mod))
        return discovered
    except Exception:
        traceback.print_exc()
        raise DiscoveryError(('\n    ' + traceback.format_exc().replace('\n', '\n    ')).rstrip())

dataset/ETHPy150Open Yelp/Testify/testify/test_discovery.py discover/original