Problem running pylons webtests. ImportError and TestController is not defined error.

SONAL ... ssonaldd at gmail.com
Fri May 20 02:31:31 EDT 2011


I have directory structure as gnukhata/tests/functional. In functional
folder I have web tests files. Following is the sample tests:

*from gnukhata.tests import *

class TestVendorController(TestController):

def test_index(self):
    response = self.app.get(url(controller='vendor', action='index'**))*

After running tests, it gives me following error:
*Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 651, in   loadByNames
    things.append(self.findByName(name))
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 460, in findByName
    return filenameToModule(name)
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 98, in filenameToModule
    return _importFromFile(fn)
  File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 117, in _importFromFile
    module = imp.load_source(moduleName, fn, fd)
  File "test_vendor.py", line 1, in <module>
    from gnukhata.tests import *
exceptions.ImportError: No module named tests*

Instead of gnukhata.tests if I write gnukhata then it shows the following error:
*Traceback (most recent call last):
    File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 651, in loadByNames
things.append(self.findByName(name))
    File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 460, in findByName
return filenameToModule(name)
    File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 98, in filenameToModule
return _importFromFile(fn)
    File "/usr/lib/python2.6/dist-packages/twisted/trial/runner.py",
line 117, in _importFromFile
    module = imp.load_source(moduleName, fn, fd)
    File "test_vendor.py", line 3, in <module>
    class TestVendorController(TestController):
exceptions.NameError: name 'TestController' is not defined
*
How to remove these errors??? Suggest me solution... Thanks in advance...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110520/3a125473/attachment.html>


More information about the Python-list mailing list