On 05/29/2015 10:47 AM, Brian Looker wrote:
I've encountered a NoSectionError while trying to test my Pyramid project, and I haven't been able to figure out why. I have successfully used ConfigParser with the interpreter to read my .ini file without error.I've pasted in my code and the stack trace below, and I would greatly appreciate any suggestions. I suspect I'm not setting something up right in my tests.py file, which goes: import unittest from pyramid.paster import get_app from webtest import TestApp class AllTests(unittest.TestCase): def test_login(self): app = get_app('testing.ini') test_app = TestApp(app) resp = test_app.get('/login') self.assertEqual(resp.status_code, 200) if __name__ == '__main__': unittest.main() I call my tests with: python tests.py. Then I get the following error. ERROR: test_login (__main__.AllTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 7, in test_login app = get_app('testing.ini') File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/pyramid/paster.py", line 31, in get_app global_conf=options) File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp return loadobj(APP, uri, name=name, **kw) File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj return context.create() File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create return self.object_type.invoke(self) File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke return fix_call(context.object, context.global_conf, **context.local_conf) File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call val = callable(*args, **kw) File "/home/brian/Documents/JobWork/pyramid-tutorial/camtasia_request/camtasia_request/__init__.py", line 29, in main config.scan() File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/pyramid/config/__init__.py", line 930, in scan ignore=ignore) File "/home/brian/Documents/JobWork/pyramid-tutorial/local/lib/python2.7/site-packages/venusian/__init__.py", line 205, in scan __import__(modname) File "/home/brian/Documents/JobWork/pyramid-tutorial/camtasia_request/camtasia_request/views.py", line 28, in <module> appContext = d2lauth.fashion_app_context(app_id=parser.get('app:main', 'APP_ID'), File "/usr/lib/python2.7/ConfigParser.py", line 607, in get raise NoSectionError(section) NoSectionError: No section: 'app:main'
I doubt anyone who isn't familiar with your codebase could know what the problem is, other than the obvious "the ini file that was parsed does not contain an app:main section".
- C -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
