Skip to content

Commit

Permalink
Move fixtures to core to allow usage in workflows and process metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
m-mohr committed Dec 19, 2023
1 parent bd0b211 commit 2aaa00e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 38 deletions.
38 changes: 38 additions & 0 deletions src/openeo_test_suite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,44 @@ def skip_experimental(request) -> str:
return skip


@pytest.fixture(scope="session")
def process_levels(request):
"""
Fixture to get the desired openEO profiles levels.
"""
levels_str = ""
# TODO: also support getting it from a config file?
if request.config.getoption("--process-levels"):
levels_str = request.config.getoption("--process-levels")
elif "OPENEO_PROCESS_LEVELS" in os.environ:
levels_str = os.environ["OPENEO_PROCESS_LEVELS"]

if isinstance(levels_str, str) and len(levels_str) > 0:
_log.info(f"Testing process levels {levels_str!r}")
return list(map(lambda l: l.strip(), levels_str.split(",")))
else:
return []


@pytest.fixture(scope="session")
def processes(request):
"""
Fixture to get the desired profiles to test against.
"""
processes_str = ""
# TODO: also support getting it from a config file?
if request.config.getoption("--processes"):
processes_str = request.config.getoption("--processes")
elif "OPENEO_PROCESSES" in os.environ:
processes_str = os.environ["OPENEO_PROCESSES"]

if isinstance(processes_str, str) and len(processes_str) > 0:
_log.info(f"Testing processes {processes_str!r}")
return list(map(lambda p: p.strip(), processes_str.split(",")))
else:
return []


@pytest.fixture
def auto_authenticate() -> bool:
"""
Expand Down
38 changes: 0 additions & 38 deletions src/openeo_test_suite/tests/processes/processing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,44 +27,6 @@ def runner(request) -> str:
return runner


@pytest.fixture(scope="session")
def process_levels(request):
"""
Fixture to get the desired openEO profiles levels.
"""
levels_str = ""
# TODO: also support getting it from a config file?
if request.config.getoption("--process-levels"):
levels_str = request.config.getoption("--process-levels")
elif "OPENEO_PROCESS_LEVELS" in os.environ:
levels_str = os.environ["OPENEO_PROCESS_LEVELS"]

if isinstance(levels_str, str) and len(levels_str) > 0:
_log.info(f"Testing process levels {levels_str!r}")
return list(map(lambda l: l.strip(), levels_str.split(",")))
else:
return []


@pytest.fixture(scope="session")
def processes(request):
"""
Fixture to get the desired profiles to test against.
"""
processes_str = ""
# TODO: also support getting it from a config file?
if request.config.getoption("--processes"):
processes_str = request.config.getoption("--processes")
elif "OPENEO_PROCESSES" in os.environ:
processes_str = os.environ["OPENEO_PROCESSES"]

if isinstance(processes_str, str) and len(processes_str) > 0:
_log.info(f"Testing processes {processes_str!r}")
return list(map(lambda p: p.strip(), processes_str.split(",")))
else:
return []


@pytest.fixture
def connection(
backend_url: str, runner: str, auto_authenticate: bool, capfd
Expand Down

0 comments on commit 2aaa00e

Please sign in to comment.