Skip to content

Instantly share code, notes, and snippets.

@nealtodd
nealtodd / settings_test_snippet.py
Last active November 14, 2019 01:25
Skip migrations for a Django 1.7 test run
# If your test settings file doesn't import any other settings file
# then you can use the function directly:
def prevent_tests_migrate(db):
import django
from django.db import connections
from django.db.migrations.executor import MigrationExecutor
django.setup()
ma = MigrationExecutor(connections[db]).loader.migrated_apps
return dict(zip(ma, ['{a}.notmigrations'.format(a=a) for a in ma]))
@charlax
charlax / progresschord.py
Created March 20, 2013 23:19
chord returning the header's task group
class ProgressChord(chord):
"""
Chord that returns both the callback's AsyncResult and the group's
AsyncResult.
"""
# See:
# http://stackoverflow.com/questions/15441101/how-to-track-the-progress-of-individual-tasks-inside-a-group-which-forms-the-hea
# https://groups.google.com/forum/?fromgroups=#!topic/celery-users/xSdxI-Z08Cw