Importing a function in a management command for unit testing

I have a management command called dorecall in an app called person. Inside this dorecall command code, there is a function called send_email(self, person) that I'd like to test. How do I import this function (or the dorecall module) in my test.py so I can test it with the django.test framework?

Here is what happens when I import:

(person)bob@sh ~/code/person/person/dapi $  > python manage.py shell
Python 2.7.2 (default, Jan  3 2012, 11:40:38)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>>> import person.management.dorecall
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ImportError: No module named dorecall

Here is the relevant structure of the app:

 ./
 ├── person
 │   ├── __init__.py
 │   ├── forms.py
 │   ├── management
 │   │   ├── __init__.py
 │   │   └── commands
 │   │       ├── __init__.py
 │   │       ├── dorecall.py
 │   │       └── dorecall.pyc

Answers


dorecall.py resides in person > management > commands > dorecall.py. So the import should be:

import person.management.commands.dorecall

Need Your Help

Should I use a Cartesian (x and y) or polar (angle and magnitude) coordinate system to represent velocity?

math vector physics game-physics

I'm programming a physics game. It seems I can use 2 systems for storing a character's movement data:

Using Word Interop, how does one tell if a table is going to span multiple pages?

c# table ms-word interop

Is there any way to catch a break in the table in order to insert a "Continued on next page" row? I've tried checking each row to see if the HeaderFormat is -1 (as I set headers to repeat on subseq...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.