Opened 10 years ago

Closed 9 years ago

#5751 closed (duplicate)

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

Reported by: Antti Kaihola 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 Antti Kaihola 10 years ago.
suggested patch, doctests now found inside multiple model files

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 years ago by Antti Kaihola

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

Changed 10 years ago by Antti Kaihola

Attachment: doctest_submodules.diff added

suggested patch, doctests now found inside multiple model files

comment:2 Changed 10 years ago by Antti Kaihola

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 10 years ago by Antti Kaihola

#3343 has an extremely lightweight alternative patch for this.

comment:4 Changed 9 years ago by Jacob

Resolution: duplicate
Status: newclosed

Duplicate of #3343.

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