[ckan-dev] Testing while Datastorer is installed
Dominik Moritz
dominik.moritz at okfn.org
Tue Jul 9 12:37:26 UTC 2013
Hello Ryan,
On 8 Jul 2013, at 22:38, Ryan Clark <ryan.clark at azgs.az.gov> wrote:
> 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...
I have seen this error before when running the datastorer and the harvester together. However, it has not been fixed yet. I am afraid that you have to disable the datastorer when running the tests that are not yet related to the datastorer. When you have to tests the datastorer in the future, run the from the datastorer and not ckan (just like the datastorer tests do at the moment).
Also, since we have talked about your plans a few months ago, you could have a look at the datapusher which will replace the datastorer soon. Hopefully, I'll be able to write the remaining bits in the next month. So, if you don't have a deadline in the next month, it might be worth using the datapusher as it is much nicer than the datastorer.
>
> Thanks!
Cheers,
Dominik
>
>
> ____________________
>
> Ryan Clark
> Arizona Geological Survey
> ryan.clark at azgs.az.gov
> (520) 302-4871
> facebook.com/ModernGeologist
> @worbly
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
Dominik Moritz
CKAN developer | skype: d.moritz | @doobly_doo
The Open Knowledge Foundation
Empowering through Open Knowledge
http://okfn.org/ | @okfn | http://ckan.org | @CKANproject
More information about the ckan-dev
mailing list