Skip to content

Commit

Permalink
Issue #42 Process selection: --processes has precedence over `--exp…
Browse files Browse the repository at this point in the history
…erimental`
  • Loading branch information
soxofaan committed Jan 26, 2024
1 parent 3984219 commit 7b156f2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ If both are specified, the union of both will be considered.
- `--experimental`: By default, experimental processes (or experimental process tests) are ignored.
Enabling this option will consider experimental processes and tests.
Note that experimental processes explicitly selected with `--processes` will be
kept irrespective of this option.
### Runner for individual process testing <a name="individual-process-testing-runner"></a>
Expand Down
14 changes: 14 additions & 0 deletions src/openeo_test_suite/lib/internal-tests/test_process_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,17 @@ def test_get_processes_filtered_with_experimental(self, process_registry):
assert pid in pids
for pid in self.PROCESS_EXAMPLES_EXPERIMENTAL:
assert pid in pids

def test_get_processes_filtered_explicit_process_over_experimental(
self, process_registry
):
"""
Processes explicitly selected with `--processes` are selected irrespective of `--experimental` flag
"""
pids = [
(p.process_id, p.experimental)
for p in process_registry.get_processes_filtered(
process_ids=["load_collection", "load_stac"], experimental=False
)
]
assert pids == [("load_collection", False), ("load_stac", True)]
13 changes: 8 additions & 5 deletions src/openeo_test_suite/lib/process_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,19 @@ def get_processes_filtered(
pid = process_data.process_id
level = process_data.level

if process_data.experimental and not experimental:
_log.debug(f"Skipping process {pid!r}: experimental")
continue

if process_ids and pid in process_ids:
yield process_data
elif process_levels and level in process_levels:
if process_data.experimental and not experimental:
_log.debug(f"Skipping process {pid!r}: experimental")
continue
yield process_data
elif not process_ids and not process_levels:
# No id or level allow lists: no filtering
# No id or level allow lists: no filtering (except experimental flag)
if process_data.experimental and not experimental:
_log.debug(f"Skipping process {pid!r}: experimental")
continue

yield process_data
else:
_log.debug(
Expand Down

0 comments on commit 7b156f2

Please sign in to comment.