Skip to content

Commit

Permalink
Merge pull request #36 from Open-EO/internal-tests
Browse files Browse the repository at this point in the history
Introduce internal test suite to test openeo_test_suite.lib internals
  • Loading branch information
soxofaan authored Jan 23, 2024
2 parents f14d2b6 + 906833d commit df14d55
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/internal-tests.yaml
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/
7 changes: 7 additions & 0 deletions src/openeo_test_suite/lib/internal-tests/README.md
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.
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

0 comments on commit df14d55

Please sign in to comment.