i’m not sure why or how you would want to run your tests using “python 
tests.py”.

i can suggest a) using pytest and b) taking a peek at our own setup here:

https://github.com/pyfidelity/rest-seed 
<https://github.com/pyfidelity/rest-seed>

and in particular:

https://github.com/pyfidelity/rest-seed/blob/master/backend/backrest/testing.py 
<https://github.com/pyfidelity/rest-seed/blob/master/backend/backrest/testing.py>

our approach there is to not feed the tests with an ini file but simply pass it 
a dictionary where we mirror the minimal required set of settings to run the 
tests.

hth,

tom


> On 29 May 2015, at 16:47, Brian Looker <[email protected] 
> <mailto:[email protected]>> 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'
> 
> Thank you for any time you spend puzzling over this.
> Peace,
> Brian
> 
> -- 
> 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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/pylons-discuss 
> <http://groups.google.com/group/pylons-discuss>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
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.

Reply via email to