1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # file: profiling.py #
from django.test.simple import run_tests
from django.conf import settings
try:
import cProfile as profile
except ImportError:
import profile
def profile_tests(*args, **kwargs):
profile.runctx('run_tests(*args, **kwargs)',
{'run_tests':run_tests,'args':args,'kwargs':kwargs},
{},
getattr(settings,'TEST_PROFILE',None)
)
# file: settings.py #
TEST_RUNNER = 'profiling.profile_tests'
TEST_PROFILE = None
|
More like this
- TestSettingsManager: temporarily change settings for tests by carljm 3 years, 5 months ago
- Dynamic Test Loading by cronosa 2 years, 1 month ago
- Query printer coroutine by fnl 2 years, 9 months ago
- Simple profile middleware by limodou 4 years, 11 months ago
- Deep package test runner by eternicode 11 months, 1 week ago
Comments