Opened 9 years ago

Closed 7 years ago

#3310 closed defect (duplicate) test does not work if there is not a in the application

Reported by: cmgreen@… Owned by: nobody
Component: Testing framework Version: master
Severity: normal Keywords:
Cc: akaihol+django@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:


I have a project where I am not using any models. My appdir looked like


I created a and the get_apps would fail to find the application, even though it was listed under installed apps. When running ./ test app, it would fail saying there was no application with that label.

Attachments (2)

test_applications_with_no_models.patch (9.0 KB) - added by medhat 9 years ago.
test_applications_with_no_models.version_2.patch (9.2 KB) - added by medhat 9 years ago.
this should replace the previous patch

Download all attachments as: .zip

Change History (7)

comment:1 Changed 9 years ago by mir@…

  • Triage Stage changed from Unreviewed to Accepted

I could reproduce this.

Traceback (most recent call last):
  File "", line 11, in ?
  File "/home/mir/lib/python/django/core/", line 1459, in execute_manager
    execute_from_command_line(action_mapping, argv)
  File "/home/mir/lib/python/django/core/", line 1382, in execute_from_command_line
    action_mapping[action](args[1:], int(options.verbosity))
  File "/home/mir/lib/python/django/core/", line 1234, in test
    app_list = [get_app(app_label) for app_label in app_labels]
  File "/home/mir/lib/python/django/db/models/", line 46, in get_app
    raise ImproperlyConfigured, "App with label %s could not be found" % app_label
django.core.exceptions.ImproperlyConfigured: App with label testapp could not be found

Changed 9 years ago by medhat

comment:2 Changed 9 years ago by medhat

  • Has patch set
  • Needs tests set

I created a patch for this, but I did not create tests... (I was not really sure how to creat tests for it :-))
If someone is interested in using this and add the tests instead of starting from scratch, that would be great.

Changed 9 years ago by medhat

this should replace the previous patch

comment:3 Changed 9 years ago by njharman <njharman@…>

This problem has an easy workaround 'touch' in relevant apps.

It can still is a bit of a gotcha though(some of my unittests weren't running for couple months and still wouldn't be if I hadn't added one and noticed the test count not increment). So, I'm working on a minimal patch to resolve this issue.

comment:4 Changed 9 years ago by akaihola

  • Cc akaihol+django@… added

There's an overlapping patch for the problem of testing models in separate files in #5751. It would make sense to merge these patches.

comment:5 Changed 7 years ago by russellm

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #7198. Even though this is the earlier ticket, I'm closing this one because #7198 describes a more general problem.

Note: See TracTickets for help on using tickets.
Back to Top