-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from Open-EO/internal-tests
Introduce internal test suite to test openeo_test_suite.lib internals
- Loading branch information
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Internal tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- 'src/openeo_test_suite/lib/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- 'src/openeo_test_suite/lib/**' | ||
|
||
jobs: | ||
internal-tests: | ||
name: "Internal tests" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v2 | ||
- name: Set up python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.9 | ||
cache: 'pip' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install . | ||
- name: "Internal tests" | ||
run: pytest src/openeo_test_suite/lib/internal-tests/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
# Internal tests | ||
|
||
This is an internal test suite for testing the internal | ||
helpers and other reusable functionality defined in `openeo_test_suite.lib`. | ||
It is not part of the official test suite, does not run against a real openEO backend | ||
and should not be run by users of the main openEO test suite. |
24 changes: 24 additions & 0 deletions
24
src/openeo_test_suite/lib/internal-tests/test_backend_under_test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from unittest import mock | ||
|
||
import pytest | ||
|
||
from openeo_test_suite.lib.backend_under_test import get_backend_url | ||
|
||
|
||
def test_get_backend_url_default(request): | ||
url = get_backend_url(config=request.config) | ||
assert url is None | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["configured_url", "expected"], | ||
[ | ||
("https://openeo.test", "https://openeo.test"), | ||
("openeo.test", "https://openeo.test"), | ||
], | ||
) | ||
def test_get_backend_url_mocked_config(configured_url, expected): | ||
config = mock.Mock() | ||
config.getoption.return_value = configured_url | ||
url = get_backend_url(config=config, required=True) | ||
assert url == expected |