I take that back.  Not resolved.

My directory structure looks like this:

/appname/models.py
/appname/utils/__init__.py (empty)
/appname/utils/util1.py

in util1.py, I do this:
from appname.models import Class1, Class2

This causes the doctests in models.py to not run.

If I change util1.py to:
from projectname.appname.models import *

the doctests in models.py are run, but I get execution errors in
util1.py.




On May 10, 7:44 pm, davenaff <[EMAIL PROTECTED]> wrote:
> Thanks for the note.  I actually just resolved this.
>
> I had created a module that resided in the appname directory, and was
> importing via: from appname.models import *
>
> I changed the import to:
> from projectname.appname.models import *
>
> And tests were correctly picked up.
>
> I think this is a bug?  I shouldn't need to include the projectname in
> modules that are fully contained within an app.
>
> On May 10, 7:18 pm, phillc <[EMAIL PROTECTED]> wrote:
>
> > can we see your models.py?
>
> > On May 10, 9:00 pm, davenaff <[EMAIL PROTECTED]> wrote:
>
> > > It is probably also worth noting that _doctest returns correct
> > > (projectname.appname.models) object.__module__  values for Managers.
>
> > > On May 10, 5:49 pm, davenaff <[EMAIL PROTECTED]> wrote:
>
> > > > As I dig into this, I've found that the problem is that the classes in
> > > > my models.py file are not being recognized as being from the module.
>
> > > > Specifically, the _from_module function in the DocTestFinder class in
> > > > _doctest.py is failing to identify the module as internal.
>
> > > > Upon closer inspection this statement (line 897 in _doctest.py)
> > > > returns false:
> > > > module.__name__ == object.__module__
>
> > > > When I print the values, they look like this:
> > > > print module.__name__
> > > > projectname.appname.models
>
> > > > print object.__module__
> > > > appname.models
>
> > > > So, I need to figure out why object.__module__ isn't providing the
> > > > full path.
>
> > > > Any ideas?
>
> > > > Dave
>
> > > > On May 10, 3:49 pm, davenaff <[EMAIL PROTECTED]> wrote:
>
> > > > > I've just begun using doctests and when I run manage.py test appname,
> > > > > the doctests in the models.py file aren't running.
>
> > > > > I have other apps in the project that have doctests that run fine.
>
> > > > > I also have taken the models in this app and pasted them into a
> > > > > different app. The doctests run fine in that app (so, I believe the
> > > > > doctest syntax is correct).
>
> > > > > I have a tests.py in the app with unit tests that work as expected.  I
> > > > > deleted the file and retried to run the test and it still did not run.
>
> > > > > I'm at a loss here.  Any ideas?
> > > > > Dave
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to