Code

Opened 7 years ago

Closed 6 years ago

#5751 closed (duplicate)

manage.py test doesn't run doctests for models split into separate files

Reported by: akaihola Owned by: nobody
Component: Testing framework Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

If models are split into separate files like this:

myapp/models/__init__.py
myapp/models/polls.py
myapp/models/posts.py

the manage.py test command only runs doctests for models defined in myapp/models/__init__.py.

This is true even if I import all the models in __init__.py.

Attachments (1)

doctest_submodules.diff (2.0 KB) - added by akaihola 7 years ago.
suggested patch, doctests now found inside multiple model files

Download all attachments as: .zip

Change History (5)

comment:1 Changed 7 years ago by akaihola

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

This seems to be doctest.DocTestFinder's intended behavior, which should be worked around if this is to be fixed.

Changed 7 years ago by akaihola

suggested patch, doctests now found inside multiple model files

comment:2 Changed 7 years ago by akaihola

  • Has patch set

Patch above. It would make sense to combine this with the patch for #3310.

I don't know how to write tests for this...

comment:3 Changed 7 years ago by akaihola

#3343 has an extremely lightweight alternative patch for this.

comment:4 Changed 6 years ago by jacob

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

Duplicate of #3343.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.