-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adapt tests to latest changes in ckanext-harvest #263
Conversation
# TODO move to ckanext-harvest | ||
@pytest.fixture | ||
def harvest_setup(): | ||
harvest_model.setup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps is best to keep the concerns for the clean_db
and harvest_setup
fixtures separated and keep harvest_setup
but refactoring it to use migrate_db_for('harvest')
rather than harvest_model.setup()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could not solve the problem otherwise. Using migrate_db_for('harvest')
in harvest_setup
or redefining clean_db
in the harvester-specific tests (test_harvester.py
& test_json_harvester.py
) does not seem to solve the issue.
All Tests that include clean_db
still throw the following exception:
sqlalchemy.exc.ProgrammingError: (psycopg2.errors.UndefinedTable) relation "harvest_object_extra" does not exist
...
/srv/app/src/ckan/ckan/tests/helpers.py:83: in reset_db
model.repo.rebuild_db()
/srv/app/src/ckan/ckan/model/init.py:229: in rebuild_db
self.delete_all()
/srv/app/src/ckan/ckan/model/init.py:250: in delete_all
connection.execute('delete from "%s"' % table.name)
/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py:982: in execute
return self.execute_text(object, multiparams, params)
/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1149: in _execute_text
ret = self._execute_context(
/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1247: in _execute_context
self._handle_dbapi_exception(
/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1466: in _handle_dbapi_exception
util.raise_from_cause(sqlalchemy_exception, exc_info)
/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py:399: in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
/usr/lib/python3.8/site-packages/sqlalchemy/util/compat.py:153: in reraise
raise value.with_traceback(tb)
/usr/lib/python3.8/site-packages/sqlalchemy/engine/base.py:1243: in _execute_context
Any ideas on how to initialize/create the plugin db tables or to put the right scope for harvest_setup ?
Maybe this was also mentioned in this discussion
@amercader We would like to get the tests working again. Perhaps you'll find some time to have a quick look at this and let us know what do you think about our last investigations? Otherwise, we suggest merging the currently working solution to move forward. |
My apologies @seitenbau-govdata, reading the linked discussion this makes perfect sense. |
@amercader No problem. Don't worry. Thanks! 😃 |
The workflow tests are currently broken when run with the master version of
ckanext-harvest
. With this commit inckanext-harvest
the way of initializing the db has been changed.This PR updates the tests for
ckanext-dcat
to solve the issue.But I`m not quite sure if this is an ideal solution. Could someone take a closer look at this?