I'm trying to diagnose some slow running unit tests, but I'm not having any luck getting the profiler working with django-nose. I came up with a repo case on a brand new Django project.
django-admin.py startproject nosetest
cd nosetest/
virtualenv --no-site-packages --distribute virtualenv
source virtualenv/bin/activate
pip install django_nose
echo "
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory',
},
}
INSTALLED_APPS = INSTALLED_APPS + ('django_nose', )
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
" >> nosetest/settings.py
echo "
import unittest
import time
class SlowTestCase(unittest.TestCase):
def test_slow(self):
self.assertFalse(time.sleep(1))
" > nosetest/test.py
python manage.py test --with-profile
This should create a new Django project in the current directory, install some dependencies in a virtualenv, create a valid settings.py and then run a new unit test.
I'm expecting to see various function calls in the output. Instead, I'm getting the following:
nosetests --verbosity 1 --with-profile
Creating test database for alias 'default'...
.
0 function calls in 0.000 seconds
Ordered by: cumulative time
ncalls tottime percall cumtime percall filename:lineno(function)
0 0.000 0.000 profile:0(profiler)
----------------------------------------------------------------------
Ran 1 test in 1.002s
OK
Destroying test database for alias 'default'...
I have tried the cProfiler with nose-cprof, but that is giving similar results. Can anyone get this same project working, or point me to another solution for profiling this test?