Skip to content

Commit

Permalink
Merge pull request #90 from openEOPlatform/fix/list_supported_processes
Browse files Browse the repository at this point in the history
Fix/list supported processes duplication
  • Loading branch information
zcernigoj authored Nov 6, 2023
2 parents 2d5b98c + 9387ee8 commit 45e1eab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/pg_to_evalscript/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import pkg_resources

implicitly_supported_processes = ["load_collection", "save_result"]

def list_supported_processes():
process_definitions_directory = "javascript_processes"
implicitly_supported_processes = ["load_collection", "save_result", "reduce_dimension", "apply"]
process_definition_files = pkg_resources.resource_listdir("pg_to_evalscript", f"{process_definitions_directory}")
supported_processes_with_files = [
process_definition_file.replace(".js", "") for process_definition_file in process_definition_files
]
return [*implicitly_supported_processes, *supported_processes_with_files]
unique_supported_processes = list(set([*implicitly_supported_processes, *supported_processes_with_files]))
return unique_supported_processes
10 changes: 4 additions & 6 deletions tests/integration_tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from pg_to_evalscript import convert_from_process_graph, list_supported_processes
from pg_to_evalscript.utils import implicitly_supported_processes

from tests.utils import (
get_process_graph_json,
Expand Down Expand Up @@ -260,13 +261,10 @@ def test_process_graphs_with_scenes(pg_name, example_input, scenes, expected_out


def test_list_supported_processes():
known_supported_processes = [
"load_collection",
"save_result",
"reduce_dimension",
"apply",
known_supported_processes = list(set([
*implicitly_supported_processes,
*get_defined_processes_from_files(),
]
]))
supported_processes = list_supported_processes()
assert len(known_supported_processes) == len(supported_processes)
assert set(known_supported_processes) == set(supported_processes)
Expand Down

0 comments on commit 45e1eab

Please sign in to comment.