diff --git a/ckanext/fork/tests/test_actions.py b/ckanext/fork/tests/test_actions.py index 4358f66..d5c2ae5 100644 --- a/ckanext/fork/tests/test_actions.py +++ b/ckanext/fork/tests/test_actions.py @@ -68,7 +68,7 @@ def test_resource_autocomplete(self, q, result_names, datasets): def test_resource_autocomplete_output_format(self, datasets): result = call_action('resource_autocomplete', q="Test Resource 08") - assert type(result) == list + assert isinstance(result, list) for dataset in result: assert set(dataset.keys()) == { diff --git a/ckanext/fork/tests/test_helpers.py b/ckanext/fork/tests/test_helpers.py index 8a91019..eac78a8 100644 --- a/ckanext/fork/tests/test_helpers.py +++ b/ckanext/fork/tests/test_helpers.py @@ -2,7 +2,7 @@ from ckan.tests import factories from ckanext.fork import helpers from ckan.plugins import toolkit -import mock +from unittest import mock @pytest.mark.usefixtures('clean_db', 'with_request_context') diff --git a/ckanext/fork/tests/test_validators.py b/ckanext/fork/tests/test_validators.py index 218fecf..a8bb763 100644 --- a/ckanext/fork/tests/test_validators.py +++ b/ckanext/fork/tests/test_validators.py @@ -3,7 +3,7 @@ import ckanext.fork.validators as fork_validators import ckan.plugins.toolkit as toolkit from ckan.tests import factories -import mock +from unittest import mock @pytest.mark.usefixtures('clean_db') @@ -45,8 +45,7 @@ def test_valid_resource_id(self, value, result): @pytest.mark.parametrize("value, result", VALID_ID_PARAMS) def test_valid_activity_id(self, value, result): user = factories.User() - resource = factories.Resource() - dataset = factories.Dataset(resources=[resource]) + dataset = factories.Dataset() activity = factories.Activity( activity_type="changed package", object_id=dataset["id"], @@ -62,7 +61,6 @@ def test_valid_activity_id(self, value, result): with result: fork_validators.valid_activity_id(key, flattened_data, {}, {'user': user['name']}) - @pytest.mark.parametrize("fork_key, fork_value, result", [ (('resources', 0, 'fork_resource'), "resource-id", does_not_raise()), (('resources', 0, 'fork_resource'), "", pytest.raises(toolkit.Invalid)), @@ -83,7 +81,6 @@ def test_check_forked_object(self, fork_key, fork_value, result): with result: fork_validators.check_forked_object(key, flattened_data, {}, {'user': 'user'}) - @pytest.mark.parametrize("new_value, result", [ ("different-value", pytest.raises(toolkit.Invalid)), ("original-value", does_not_raise()), @@ -102,5 +99,3 @@ def test_dataset_field_not_changed(self, new_value, result): {}, {'user': 'user', 'package': dataset} ) - - diff --git a/setup.py b/setup.py index 8784d07..19b949c 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ # You can just specify the packages manually here if your project is # simple. Or you can use find_packages(). packages=find_packages(exclude=['contrib', 'docs', 'tests*']), - namespace_packages=['ckanext'], + namespace_packages=['ckanext'], install_requires=[ # CKAN extensions should not list dependencies here, but in a separate