Opened 18 years ago
Closed 17 years ago
#3994 closed (duplicate)
doctest in projects with models split into seperate files not working
Reported by: | Owned by: | Adrian Holovaty | |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've taken over a project with a lot of models and split them into separate files (project/app/models/ModelName.py, etc. and doing the imports in the init.py) 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 by , 18 years ago
Component: | Core framework → Unit test system |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 18 years ago
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 settings.py (and setup your db of course)
- Enter foo
- Remove models.py
- mkdir models
- Enter foo/models
- Create file foo/models/Blog.py
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" True """ title = models.CharField(maxlength=50) body = models.TextField() class Meta: app_label='foo'
... (spam bot is hating) ...
comment:4 by , 18 years ago
Ok, I can't get the rest of the example through the spam protection so I'll attach it as a file.
comment:5 by , 18 years ago
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/init.py then syncdb then test.
Can you please provide an example/test to help us track this down?