[ckan-dev] Testing while Datastorer is installed

Ryan Clark ryan.clark at azgs.az.gov
Mon Jul 8 21:38:32 UTC 2013


My CKAN environment includes the Datastorer plugin. I am writing tests for a completely separate functionality, but running into a problem. When trying to create a resource via toolkit.get_action("resource_create"), I trigger the IDomainObjectModification interface, which calls Datastorer's notify method (https://github.com/okfn/ckanext-datastorer/blob/master/ckanext/datastorer/plugin.py#L25).

... which fails on line 42: https://github.com/okfn/ckanext-datastorer/blob/master/ckanext/datastorer/plugin.py#L42

File "/Users/ryan/ngds/reboot/src/ckanext-datastorer/ckanext/datastorer/plugin.py", line 42, in _create_datastorer_task
    'site_url': h.url_for_static('/', qualified=True),
  File "/Users/ryan/ngds/reboot/src/ckan/ckan/lib/helpers.py", line 103, in url_for_static
    my_url = _routes_default_url_for(*args, **kw)
  File "/Users/ryan/ngds/reboot/lib/python2.7/site-packages/routes/util.py", line 257, in url_for
    host = config.host
  File "/Users/ryan/ngds/reboot/lib/python2.7/site-packages/routes/__init__.py", line 14, in __getattr__
    return getattr(self.__shared_state, name)
AttributeError: 'thread._local' object has no attribute 'host'

I am running tests via:

{{ path to virtualenv }}/bin/nosetests --ckan --with-pylons=/Users/ryan/ngds/reboot/src/ckan/test.ini --nologcapture

If I run

{{ path to virtualenv }}/bin/paster celeryd --config=/Users/ryan/ngds/reboot/src/ckan/test.ini

... before I run the tests, then paster crashes, before I even try and add any resources.

Obvious workaround is to take datastorer out of my test.ini file, but at the same time, then I'm not really testing in my "real" environment, which doesn't feel good. Plus I do need to test datastorer-related functionality eventually...

Thanks!


____________________

Ryan Clark
Arizona Geological Survey
ryan.clark at azgs.az.gov
(520) 302-4871
facebook.com/ModernGeologist
@worbly









-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130708/0bda3e4e/attachment.html>


More information about the ckan-dev mailing list