Skip to content

Commit 474b7d2

Browse files
authored
add filename construct validation (#432)
1 parent 9c8aafd commit 474b7d2

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ci/src/_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def plugin_reader() -> P:
5353
return manifests
5454

5555
def get_plugin_files() -> list[str]:
56-
return [os.path.join(plugin_dir, file) for file in os.listdir(plugin_dir)]
56+
return [os.path.join(plugin_dir, filename) for filename in get_plugin_filenames()]
57+
58+
def get_plugin_filenames() -> list[str]:
59+
return [file for file in os.listdir(plugin_dir)]
5760

5861
def etag_reader() -> ETagsType:
5962
with open(etag_file, "r", encoding="utf-8") as f:

ci/src/validator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*-coding: utf-8 -*-
2-
from _utils import clean, id_name, language_list, language_name, plugin_reader, check_url, icon_path, get_plugin_files
2+
from _utils import clean, id_name, language_list, language_name, plugin_reader, check_url, icon_path, get_plugin_files, get_plugin_filenames
33

44
plugin_infos = plugin_reader()
55

@@ -28,3 +28,10 @@ def test_file_type_json():
2828
incorrect_ext_files = [file for file in get_plugin_files() if not file.endswith(".json")]
2929

3030
assert len(incorrect_ext_files) == 0, f"Expected the following file to be of .json extension: {incorrect_ext_files}"
31+
32+
def test_file_name_construct():
33+
filenames = get_plugin_filenames()
34+
for info in plugin_infos:
35+
assert (
36+
f"{info['Name']}-{info['ID']}.json" in filenames
37+
), f"Plugin {info['Name']} with ID {info['ID']} does not have the correct filename. Make sure it's name + ID, i.e. {info['Name']}-{info['ID']}.json"

0 commit comments

Comments
 (0)