Skip to content

Commit

Permalink
Load plugins in validation/subfields tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Jun 14, 2024
1 parent 0b67416 commit 1d1edab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ckanext/scheming/tests/test_subfields.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


@pytest.mark.usefixtures("with_plugins", "clean_db")
@pytest.mark.ckan_config("ckan.plugins", "scheming_datasets scheming_subfields_index")
def test_repeating_subfields_index():

with mock.patch("ckan.lib.search.index.make_connection") as m:
Expand All @@ -31,6 +32,7 @@ def test_repeating_subfields_index():


@pytest.mark.usefixtures("with_plugins", "clean_db")
@pytest.mark.ckan_config("ckan.plugins", "scheming_datasets scheming_subfields_index")
def test_repeating_subfields_search():

dataset = call_action("package_create", **dataset_dict)
Expand Down
18 changes: 16 additions & 2 deletions ckanext/scheming/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@
not_empty = get_validator("not_empty")


pytestmark = [
pytest.mark.usefixtures("with_plugins"),
pytest.mark.ckan_config(
"ckan.plugins",
" ".join([
"scheming_datasets",
"scheming_groups",
"scheming_organizations",
"scheming_test_plugin",
"scheming_subfields_index",
"scheming_test_validation",
])
)
]


class TestGetValidatorOrConverter(object):
def test_missing(self):
with pytest.raises(SchemingException):
Expand Down Expand Up @@ -941,8 +957,6 @@ def test_invalid_choice(self):
raise AssertionError("ValidationError not raised")


@pytest.mark.ckan_config("ckan.plugins", "scheming_test_validation")
@pytest.mark.usefixtures("with_plugins")
class TestValidatorsFromString:
def test_empty(self):
assert validators_from_string("", {}, {}) == []
Expand Down

0 comments on commit 1d1edab

Please sign in to comment.