Opened 8 years ago

Closed 8 years ago

#3994 closed (duplicate)

doctest in projects with models split into seperate files not working

Reported by: jesse.lovelace@… Owned by: adrian
Component: Testing framework Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


I've taken over a project with a lot of models and split them into separate files (project/app/models/, etc. and doing the imports in the and everything works well...except doctest.

My doctests were working with the all-models-in-one-file setup but aren't
anymore--unit tests still work though. SVN Django and python 2.4.3.

Change History (6)

comment:1 Changed 8 years ago by Simon G. <dev@…>

  • Component changed from Core framework to Unit test system
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Can you please provide an example/test to help us track this down?

comment:2 Changed 8 years ago by jesse.lovelace@…

Sure, let just let me know what you need as far as specifics, here is a (not so) minimal overall example.

  • Start project 'blah'
  • Start app foo & add to (and setup your db of course)
  • Enter foo
  • Remove
  • mkdir models
  • Enter foo/models
  • Create file foo/models/
    from dhango.db import models
    class Blog(models.Model):
        A blog.
        >>> b = Blog.objects.create(title="Great post", body="Wow, that was great.")
        >>> b.title=="Great post"
        title = models.CharField(maxlength=50)
        body = models.TextField()
        class Meta:

... (spam bot is hating) ...

comment:3 Changed 8 years ago by jesse.lovelace@…

... continued ...

  • Create file (optionally) foo/models/

comment:4 Changed 8 years ago by jesse.lovelace@…

Ok, I can't get the rest of the example through the spam protection so I'll attach it as a file.

comment:5 Changed 8 years ago by jesse.lovelace@…

The spam protection is making me a little crazy, I couldn't attach the file with the comment class (and then got blocked on posts per hour) nor give any more code at all. Basically just create a comment model in foo/models/ and then import those in foo/models/ then syncdb then test.

comment:6 Changed 8 years ago by russellm

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

Duplicate of #3343.

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