Example #1
0
def setup():
    if os.environ.get('COVER_ALL_MODULES') or '--with-coverage3' in sys.argv:
        from celery.tests.utils import catch_warnings
        with catch_warnings(record=True):
            import_all_modules()
        warnings.resetwarnings()
Example #2
0
    current_dist_depth = len(name.split('.')) - 1
    current_dist = os.path.join(os.path.dirname(file),
                                *([os.pardir] * current_dist_depth))
    abs = os.path.abspath(current_dist)
    dist_name = os.path.basename(abs)

    for dirpath, dirnames, filenames in os.walk(abs):
        package = (dist_name + dirpath[len(abs):]).replace('/', '.')
        if '__init__.py' in filenames:
            yield package
            for filename in filenames:
                if filename.endswith('.py') and filename != '__init__.py':
                    yield '.'.join([package, filename])[:-3]


def import_all_modules(name=__name__, file=__file__,
        skip=['celery.decorators', 'celery.contrib.batches']):
    for module in find_distribution_modules(name, file):
        if module not in skip:
            try:
                import_module(module)
            except ImportError:
                pass


if os.environ.get('COVER_ALL_MODULES') or '--with-coverage3' in sys.argv:
    from celery.tests.utils import catch_warnings
    with catch_warnings(record=True):
        import_all_modules()
    warnings.resetwarnings()
Example #3
0
def setup():
    if os.environ.get('COVER_ALL_MODULES') or '--with-coverage3' in sys.argv:
        from celery.tests.utils import catch_warnings
        with catch_warnings(record=True):
            import_all_modules()
        warnings.resetwarnings()