diff --git a/Makefile b/Makefile index 3b6c47f..b1b349b 100644 --- a/Makefile +++ b/Makefile @@ -4,13 +4,16 @@ test-requirements: test: test-lint test-unit test-types test-format ## Run all tests by decreasing order of priority test-format: ## Run code formatting tests - black --check --diff tests.py + black --check --diff *.py test-lint: ## Run code linting tests - pylint --errors-only --enable=unused-import,unused-argument --ignore=templates tests.py + pylint --errors-only --enable=unused-import,unused-argument --ignore=templates *.py test-unit: ## Run unit tests python -m unittest run ./tests.py test-types: ## Check type definitions - mypy --ignore-missing-imports --implicit-reexport --strict tests.py + mypy --ignore-missing-imports --implicit-reexport --strict *.py + +format: ## Format code + black *.py diff --git a/tests.py b/tests.py index 178557b..7af95b2 100644 --- a/tests.py +++ b/tests.py @@ -30,14 +30,16 @@ def test_names_are_unique(self) -> None: names.add(plugin["name"]) def test_all_plugins_have_all_fields(self) -> None: + required_fields = ["src", "url", "author", "maintainer", "description"] for release in RELEASES: for index in INDEXES: for plugin in load_index(release, index): - self.assertIn("src", plugin) - self.assertIn("url", plugin) - self.assertIn("author", plugin) - self.assertIn("maintainer", plugin) - self.assertIn("description", plugin) + for field in required_fields: + self.assertIn(field, plugin) + self.assertTrue( + plugin[field] and plugin[field].strip(), + f"Field {field} cannot be empty", + ) def load_index(release: str, index: str) -> list[dict[str, str]]: