How do I run unit tests in a tipfy app?

77 views
Skip to first unread message

Charlie

unread,
Jan 18, 2011, 11:07:34 AM1/18/11
to tipfy
Given a standard set-up, how do you run unit tests that let you use
the Tipfy test client?

I'm trying to add client unit tests for a small tipfy app that I'm
porting from Django. I found the examples for using the tipfy test
client, but when I run the unit tests it can't find the tipfy module.
I've started from the base all-in-one project, so my app is in:

app/apps/my_app

Here's the command, after cd-ing to the app directory:

$ nosetests --with-gae --without-sandbox
E
======================================================================
ERROR: Failure: ImportError (No module named tipfy)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/nose-1.0.0-py2.5.egg/nose/
loader.py", line 390, in loadTestsFromName
addr.filename, addr.module)
File "/Library/Python/2.5/site-packages/nose-1.0.0-py2.5.egg/nose/
importer.py", line 39, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Library/Python/2.5/site-packages/nose-1.0.0-py2.5.egg/nose/
importer.py", line 86, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/charlieevett/code/channel-services/app/apps/podcast/
tests.py", line 12, in <module>
from tipfy import Tipfy
ImportError: No module named tipfy

Charlie

unread,
Jan 24, 2011, 12:32:36 PM1/24/11
to tipfy
OK, let me try asking another way. How do YOU run unit tests in your
tipfy app?

Simon Payne

unread,
Jan 24, 2011, 12:36:36 PM1/24/11
to ti...@googlegroups.com
I don't run test ;)
I just create stuff and go forward :D
But if I ever create tests there are plenty of tools for that in python. I'd probably run them on pre-commit hook in mercurial so that code in repository would be always tested ...

2011/1/24 Charlie <charli...@gmail.com>
--
You received this message because you are subscribed to the Google Groups "tipfy" group.
To post to this group, send email to ti...@googlegroups.com.
To unsubscribe from this group, send email to tipfy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tipfy?hl=en.


Matthew

unread,
Jan 24, 2011, 9:14:51 PM1/24/11
to tipfy
It looks like tipfy is not on your PYTHONPATH. Make sure it is, or
temporarily set it on your PYTHONPATH just before running your tests.

I've also found that getting the absolute paths to files is necessary
if you want to run any tools like Hudson. Relative links will break
because code is copied to another directory before it's built and
tests run. To do so, call:

os.path.normpath(your-relative-path)

-Matthew
Reply all
Reply to author
Forward
0 new messages