CKAN测试错误:“ KeyError:'标签'”

时间:2018-07-20 14:28:51

标签: ckan

测试通过CI,但是在本地测试master时出现错误:

$ nosetests --ckan --with-pylons=test-core.ini ckan/tests/logic/action/test_get.py -x
No handlers could be found for logger "ckan.lib.uploader"
.../usr/lib/ckan/default/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py:2181: SAWarning: Usage of the 'related attribute set' operation is not currently supported within the execution stage of the flush process. Results may not be consistent.  Consider using alternative event listeners or connection-level operations instead.
  % method)
........................................................................................................................E
======================================================================
ERROR: ckan.tests.logic.action.test_get.TestTagShow.test_tag_show_for_vocab_tag
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/vagrant/src/ckan/ckan/tests/logic/action/test_get.py", line 1857, in test_tag_show_for_vocab_tag
    tag_in_dataset = dataset['tags'][0]
KeyError: 'tags'

----------------------------------------------------------------------
Ran 124 tests in 66.301s

FAILED (errors=1)

通过运行以下两个测试,我可以更快地重新创建它:

nosetests --ckan --with-pylons=test-core.ini ckan/tests/logic/action/test_get.py:TestPackageAutocompleteWithDatasetForm.test_custom_schema_returned ckan/tests/logic/action/test_get.py:TestTagShow.test_tag_show_for_vocab_tag

还有其他人有这个问题吗?或者仅仅是我吗?有没有人知道如何解决它?

(我的部门是最新的,已完成:pip install -r requirements.txt -r dev-requirements.txt

1 个答案:

答案 0 :(得分:0)

我发现问题是test_get.py没有正确清理,因为缺少对拆机的呼叫。修复:https://github.com/ckan/ckan/pull/4371