title: Nose doesn't find Django tests
body: <p>I am trying to use Django-nose in my current project, but I can't figure out how to get nose to run my tests. So I started a simple Django 1.4.1 project to get to know nose. But not even on this simple test project I could get it running.</p>
  
  <p>Before I go on: I know there are a ton of similar questions on Stackoverflow, like for instance this one:</p>
  
  <p><a href="https://stackoverflow.com/questions/6065151/how-do-i-tell-django-nose-where-my-tests-are">How do I tell Django-nose where my tests are?</a></p>
  
  <p>But after Googling around, reading blog posts and StackOverflow answers I still couldn't get it running.</p>
  
  <h2>How I set up my test project</h2>
  
  <ol>
  <li>Create virtual environment.</li>
  <li><code>pip install django django-nose nose</code>.</li>
  <li>Create project with <code>django-admin.py startproject djangonosetest</code>.</li>
  <li>Create an app <code>manage.py startapp testapp</code></li>
  <li><p>Edit settings.py:</p>
  
  <ul>
  <li>Set <code>ENGINE</code> to <code>django.db.backends.sqlite3</code></li>
  <li>Added <code>django_nose</code>, <code>testapp</code> to <code>INSTALLED_APPS</code></li>
  <li>Added <code>TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'</code>.</li>
  </ul></li>
  <li><p>Run <code>manage.py test</code></p></li>
  </ol>
  
  <p>But all I got was this output:</p>
  
  <pre><code>nosetests --verbosity 1
  Creating test database for alias 'default'...
  
  ----------------------------------------------------------------------
  Ran 0 tests in 0.000s
  
  OK
  Destroying test database for alias 'default'...
  </code></pre>
  
  <p>But at least the default test case should have been run.</p>
  
  <p><strong>When I run <code>python manage.py test djangonosetest.testapp.tests:SimpleTest</code> it'll run the test. But that seems a bit overkill if I had to do it for every test file I have. But it proves that the tests can be run.</strong></p>
  
  <p>When I ran <code>manage.py test -v 3</code> (high verbosity level) this showed up:</p>
  
  <pre><code>nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/settings.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/settings.pyc is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/urls.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/wsgi.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/testapp/models.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/testapp/models.pyc is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/testapp/views.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/testapp/tests.py is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/testapp/tests.pyc is executable; skipped
  nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/manage.py is executable; skipped
  </code></pre>
  
  <p>The nose does definitely find my tests.py but is skipping it for some reason.</p>
  
  <h2>Folder structure</h2>
  
  <pre><code>djangonosetest/
      djangonosetest/
          __init__.py
          settings.py
          testapp/
              __init__.py
              models.py
              tests.py
              views.py
          urls.py
          wsgi.py
      manage.py
  </code></pre>
  
  <h2>settings.py</h2>
  
  <pre><code>DEBUG = True
  TEMPLATE_DEBUG = DEBUG
  
  ADMINS = (
      # ('Your Name', 'your_email@example.com'),
  )
  
  MANAGERS = ADMINS
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
          'NAME': '',                      # Or path to database file if using sqlite3.
          'USER': '',                      # Not used with sqlite3.
          'PASSWORD': '',                  # Not used with sqlite3.
          'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
          'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
      }
  }
  
  # Local time zone for this installation. Choices can be found here:
  # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
  # although not all choices may be available on all operating systems.
  # In a Windows environment this must be set to your system time zone.
  TIME_ZONE = 'America/Chicago'
  
  # Language code for this installation. All choices can be found here:
  # http://www.i18nguy.com/unicode/language-identifiers.html
  LANGUAGE_CODE = 'en-us'
  
  SITE_ID = 1
  
  # If you set this to False, Django will make some optimizations so as not
  # to load the internationalization machinery.
  USE_I18N = True
  
  # If you set this to False, Django will not format dates, numbers and
  # calendars according to the current locale.
  USE_L10N = True
  
  # If you set this to False, Django will not use timezone-aware datetimes.
  USE_TZ = True
  
  # Absolute filesystem path to the directory that will hold user-uploaded files.
  # Example: "/home/media/media.lawrence.com/media/"
  MEDIA_ROOT = ''
  
  # URL that handles the media served from MEDIA_ROOT. Make sure to use a
  # trailing slash.
  # Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
  MEDIA_URL = ''
  
  # Absolute path to the directory static files should be collected too.
  # Don't put anything in this directory yourself; store your static files
  # in apps' "static/" subdirectories and in STATICFILES_DIRS.
  # Example: "/home/media/media.lawrence.com/static/"
  STATIC_ROOT = ''
  
  # URL prefix for static files.
  # Example: "http://media.lawrence.com/static/"
  STATIC_URL = '/static/'
  
  # Additional locations of static files
  STATICFILES_DIRS = (
      # Put strings here, like "/home/html/static" or "C:/www/django/static".
      # Always use forward slashes, even on Windows.
      # Don't forget to use absolute paths, not relative paths.
  )
  
  # List of finder classes that know how to find static files in
  # various locations.
  STATICFILES_FINDERS = (
      'django.contrib.staticfiles.finders.FileSystemFinder',
      'django.contrib.staticfiles.finders.AppDirectoriesFinder',
  #    'django.contrib.staticfiles.finders.DefaultStorageFinder',
  )
  
  # Make this unique and don't share it with anybody.
  SECRET_KEY = 'ikh^t)49eincyww4@nq(o)go_129zdr87*im00m^+h@_n!w4ec'
  
  # List of callables that know how to import templates from various sources.
  TEMPLATE_LOADERS = (
      'django.template.loaders.filesystem.Loader',
      'django.template.loaders.app_directories.Loader',
  #     'django.template.loaders.eggs.Loader',
  )
  
  MIDDLEWARE_CLASSES = (
      'django.middleware.common.CommonMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      # Uncomment the next line for simple clickjacking protection:
      # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
  )
  
  ROOT_URLCONF = 'djangonosetest.urls'
  
  # Python dotted path to the WSGI application used by Django's runserver.
  WSGI_APPLICATION = 'djangonosetest.wsgi.application'
  
  TEMPLATE_DIRS = (
      # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
      # Always use forward slashes, even on Windows.
      # Don't forget to use absolute paths, not relative paths.
  )
  
  INSTALLED_APPS = (
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.sites',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      # Uncomment the next line to enable the admin:
      # 'django.contrib.admin',
      # Uncomment the next line to enable admin documentation:
      # 'django.contrib.admindocs',
      'django_nose',
      'djangonosetest.testapp',
  )
  
  # A sample logging configuration. The only tangible logging
  # performed by this configuration is to send an email to
  # the site admins on every HTTP 500 error when DEBUG=False.
  # See http://docs.djangoproject.com/en/dev/topics/logging for
  # more details on how to customize your logging configuration.
  LOGGING = {
      'version': 1,
      'disable_existing_loggers': False,
      'filters': {
          'require_debug_false': {
              '()': 'django.utils.log.RequireDebugFalse'
          }
      },
      'handlers': {
          'mail_admins': {
              'level': 'ERROR',
              'filters': ['require_debug_false'],
              'class': 'django.utils.log.AdminEmailHandler'
          }
      },
      'loggers': {
          'django.request': {
              'handlers': ['mail_admins'],
              'level': 'ERROR',
              'propagate': True,
          },
      }
  }
  
  TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
  </code></pre>
  
  <h2>The test code</h2>
  
  <p>The test code is the default TestCase Django creates.</p>
  
  <pre><code>"""
  This file demonstrates writing tests using the unit test module. These will pass
  when you run "manage.py test".
  
  Replace this with more appropriate tests for your application.
  """
  
  from Django.test import TestCase
  
  
  class SimpleTest(TestCase):
      def test_basic_addition(self):
          """
          Tests that 1 + 1 always equals 2.
          """
          self.assertEqual(1 + 1, 2)
  </code></pre>
  
  <p><strong>So how do I tell Django-nose/nose where my tests are?</strong></p>
  
  <h2>UPDATE</h2>
  
  <p>If found an interesting Google Groups post and Stackoverflow answer on the subject:</p>
  
  <ul>
  <li><a href="https://groups.google.com/forum/?fromgroups=#!topic/nose-users/D03-20ChmBo" rel="nofollow noreferrer">Google Groups Post</a></li>
  <li><a href="https://stackoverflow.com/a/1579787/190823">Stackoverflow answer</a></li>
  </ul>
  
  <p>Both boil down to the fact that nose will skip executable files. That's why I get <code>tests.py is executable; skipped</code>. Problem is that the file is not executable:</p>
  
  <pre><code>----------+ 1 Jens  staff  383 13 Okt 00:01 tests.py
  </code></pre>
  
  <p>I also tried it with u-x, g-x and o-x but nose skipped anyway. I get the feeling that this is a bug. The file is found in the nose, is not executable but still skipped.</p>
  
  <p>A workaround is to use the --exe switch. Running <code>manage.py test --exe</code> runs the test. While it's better than the other workarounds I am not completely happy with that solution.</p>