None

Django apps need models.py

December 13, 2009

Individual apps inside a django site need to have a models.py, or else the test framework doesn't find them, and so doesn't run the tests:

$ ./manage.py test feeds
Traceback (most recent call last):          
  File "./manage.py", line 13, in <module>  
    execute_manager(settings)               
  File "/home/user/bbr/django/core/management/__init__.py", line 439, in execute_manager
    utility.execute()                                                                      
  File "/home/user/bbr/django/core/management/__init__.py", line 380, in execute        
    self.fetch_command(subcommand).run_from_argv(self.argv)                                
  File "/home/user/bbr/django/core/management/base.py", line 195, in run_from_argv      
    self.execute(*args, **options.__dict__)                                                
  File "/home/user/bbr/django/core/management/base.py", line 222, in execute            
    output = self.handle(*args, **options)                                                 
  File "/home/user/bbr/south/management/commands/test.py", line 27, in handle           
    super(Command, self).handle(*args, **kwargs)                                           
  File "/home/user/bbr/django/core/management/commands/test.py", line 23, in handle     
    failures = test_runner(test_labels, verbosity=verbosity, interactive=interactive)      
  File "/home/user/bbr/bbr/tests.py", line 21, in test_runner_with_coverage             
    test_results = django_test_runner(test_labels, verbosity, interactive, extra_tests)    
  File "/home/user/bbr/django/test/simple.py", line 178, in run_tests                   
    app = get_app(label)                                                                   
  File "/home/user/web/django/db/models/loading.py", line 125, in get_app               
    raise ImproperlyConfigured, "App with label %s could not be found" % app_label         
django.core.exceptions.ImproperlyConfigured: App with label feeds could not be found

To solve this, simply add in an empty models.py to your app.

Tags: django test model