Opened 4 years ago

Closed 4 years ago

#16217 closed Bug (duplicate)

Test runner doesn't report import errors if models is a directory

Reported by: francis@… Owned by: nobody
Component: Testing framework Version: 1.3
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by ramiro)

I have an application whose models module is a directory with models/

That applications tests were mysteriously not being found or run when doing "./ test".

On investigation, I found out this was because there was a syntax error in my test code, and that this wasn't reported because of a bug in django/test/

If import fails, it tries to find whether the test module is there with this code:

mod = find_module(TEST_MODULE, [os.path.dirname(app_module.__file__)])

Unfortunately, my app module file was models/__init__.pyc, so that code looked for the module within the models directory.

I don't understand the relationship between __import__ and find_module well enough to know what the fix it.

Change History (1)

comment:1 Changed 4 years ago by ramiro

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #12658.

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