Pyramid Unittesting my application

135 views
Skip to first unread message

Rescommues

unread,
Sep 15, 2011, 11:26:36 AM9/15/11
to pylons-discuss
I am using pyramid 1.2b2 and have some unittests I'd like to run. But
I can not get past the error below.
I started my project with sqlalchemy scaffolding.
I have created a simple unit tests (starting point actually) in
tests.py which looks like this:


import unittest
from pyramid.config import Configurator
from pyramid import testing

class testBasic( unittest.TestCase ):
def setUp( self ):
self.config = testing.setUp( )

def tearDown( self ):
testing.tearDown( )

def test_first_last( self ):
pass

In the errors it seems that something is wrong with
"paster_plugins=['pyramid']" in setup.py.
I should note that "python setup.py develop" executes successfully.


This is the result when I run the test:


(ENV2)rescommunes@snax ~/development/Shad $ python setup.py test -q
running test
running egg_info
writing requirements to sha.egg-info/requires.txt
writing Shad.egg-info/PKG-INFO
writing top-level names to Shad.egg-info/top_level.txt
writing dependency_links to Shad.egg-info/dependency_links.txt
writing entry points to Shad.egg-info/entry_points.txt
writing paster_plugins to Shad.egg-info/paster_plugins.txt
reading manifest file 'Shad.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'Shad.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
File "setup.py", line 51, in <module>
paster_plugins=['pyramid'],
File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib/python2.7/distutils/dist.py", line 953, in
run_commands
self.run_command(cmd)
File "/usr/lib/python2.7/distutils/dist.py", line 972, in
run_command
cmd_obj.run()
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
121, in run
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
101, in with_project_on_sys_path
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
130, in run_tests
File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
self.parseArgs(argv)
File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
self.createTests()
File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
self.module)
File "/usr/lib/python2.7/unittest/loader.py", line 128, in
loadTestsFromNames
suites = [self.loadTestsFromName(name, module) for name in names]
File "/usr/lib/python2.7/unittest/loader.py", line 103, in
loadTestsFromName
return self.loadTestsFromModule(obj)
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
34, in loadTestsFromModule
File "/usr/lib/python2.7/unittest/loader.py", line 103, in
loadTestsFromName
return self.loadTestsFromModule(obj)
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
34, in loadTestsFromModule
File "/usr/lib/python2.7/unittest/loader.py", line 103, in
loadTestsFromName
return self.loadTestsFromModule(obj)
File "build/bdist.linux-i686/egg/setuptools/command/test.py", line
34, in loadTestsFromModule
File "/usr/lib/python2.7/unittest/loader.py", line 91, in
loadTestsFromName
module = __import__('.'.join(parts_copy))
ValueError: Empty module name

Any suggestions would be great.
Thank You.

Chris McDonough

unread,
Sep 15, 2011, 12:28:48 PM9/15/11
to pylons-...@googlegroups.com

The default test runner is easily confused and outputs very poor error
messages. You might try using the Nose testrunner instead. Do
"easy_install nose" in your virtualenv, then run "setup.py nosetests"
instead of "setup.py test". It will likely fail, but it will provide a
better error message.

- C

Rescommues

unread,
Sep 15, 2011, 12:36:26 PM9/15/11
to pylons-discuss
Thanks, this allows me to run my tests.
Reply all
Reply to author
Forward
0 new messages