This is an automated email from the ASF dual-hosted git repository. sbp pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
commit d3978f3f45f652bb592caa78e9bf8ffc851577f3 Author: Sean B. Palmer <[email protected]> AuthorDate: Thu Jan 8 20:41:49 2026 +0000 Group unit tests and use a clearer name for the Playwright test script --- .github/workflows/build.yml | 2 +- atr/docs/running-and-creating-tests.md | 2 +- tests/{run-tests.sh => run-playwright.sh} | 0 tests/run-unit.sh | 7 +++ tests/{datasources => unit}/__init__.py | 0 tests/{ => unit}/datasources/__init__.py | 0 tests/{ => unit}/datasources/test_apache.py | 54 +++++++++++----------- .../datasources/testdata/committees.json | 0 tests/{ => unit}/datasources/testdata/groups.json | 0 .../datasources/testdata/ldap_projects.json | 0 .../{ => unit}/datasources/testdata/podlings.json | 0 .../{ => unit}/datasources/testdata/projects.json | 0 .../datasources/testdata/retired_committees.json | 0 13 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17e0943..70a474c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,4 +49,4 @@ jobs: - name: Run Playwright end-to-end tests run: | - sh tests/run-tests.sh + sh tests/run-playwright.sh diff --git a/atr/docs/running-and-creating-tests.md b/atr/docs/running-and-creating-tests.md index aca85c1..8d123f8 100644 --- a/atr/docs/running-and-creating-tests.md +++ b/atr/docs/running-and-creating-tests.md @@ -22,7 +22,7 @@ To run the tests, you will need Docker. Other OCI runtimes should work, but you The simplest way to run the tests is using Docker Compose, which starts both ATR and the Playwright test container: ```shell -sh tests/run-tests.sh +sh tests/run-playwright.sh ``` This uses [`tests/docker-compose.yml`](/ref/tests/docker-compose.yml) to orchestrate the test environment. The ATR server runs in one container and the Playwright tests run in another, connected via a Docker network. These tests are automatically run in our GitHub CI as part of [`.github/workflows/build.yml`](/ref/.github/workflows/build.yml). diff --git a/tests/run-tests.sh b/tests/run-playwright.sh similarity index 100% rename from tests/run-tests.sh rename to tests/run-playwright.sh diff --git a/tests/run-unit.sh b/tests/run-unit.sh new file mode 100755 index 0000000..1748f96 --- /dev/null +++ b/tests/run-unit.sh @@ -0,0 +1,7 @@ +#!/bin/sh +if [ ! -d .venv ] +then + echo "You must be in the root directory of the project to run this script" + exit 1 +fi +PYTHONPATH=. exec uv run --frozen pytest tests/unit/ diff --git a/tests/datasources/__init__.py b/tests/unit/__init__.py similarity index 100% copy from tests/datasources/__init__.py copy to tests/unit/__init__.py diff --git a/tests/datasources/__init__.py b/tests/unit/datasources/__init__.py similarity index 100% rename from tests/datasources/__init__.py rename to tests/unit/datasources/__init__.py diff --git a/tests/datasources/test_apache.py b/tests/unit/datasources/test_apache.py similarity index 100% rename from tests/datasources/test_apache.py rename to tests/unit/datasources/test_apache.py index 99f4c6a..bf57ef3 100644 --- a/tests/datasources/test_apache.py +++ b/tests/unit/datasources/test_apache.py @@ -29,19 +29,6 @@ from atr.datasources.apache import ( ) -def _load_test_data(name: str) -> Any: - with open(os.path.join(os.path.dirname(__file__), "testdata", f"{name}.json")) as f: - return json.load(f) - - -def test_ldap_projects_data_model(): - projects = LDAPProjectsData.model_validate(_load_test_data("ldap_projects")) - - assert projects is not None - assert projects.project_count == 1 - assert projects.projects[0].name == "tooling" - - def test_committee_data_model(): committees = CommitteeData.model_validate(_load_test_data("committees")) @@ -57,14 +44,20 @@ def test_committee_data_model(): assert "wave" in map(lambda x: x.id, tooling.chair) -def test_retired_committee_data_model(): - retired_committees = RetiredCommitteeData.model_validate(_load_test_data("retired_committees")) +def test_groups_data_model(): + groups = GroupsData.model_validate(_load_test_data("groups")) - assert retired_committees is not None - assert retired_committees.retired_count == 1 + assert len(groups) == 2 + assert groups.get("accumulo") is not None + assert groups.get("accumulo-pmc") is not None - pmc = retired_committees.retired[0] - assert pmc.name == "abdera" + +def test_ldap_projects_data_model(): + projects = LDAPProjectsData.model_validate(_load_test_data("ldap_projects")) + + assert projects is not None + assert projects.project_count == 1 + assert projects.projects[0].name == "tooling" def test_podlings_data_model(): @@ -76,16 +69,23 @@ def test_podlings_data_model(): assert podling.name == "Apache Amoro (Incubating)" -def test_groups_data_model(): - groups = GroupsData.model_validate(_load_test_data("groups")) - - assert len(groups) == 2 - assert groups.get("accumulo") is not None - assert groups.get("accumulo-pmc") is not None - - def test_projects_data_model(): projects = ProjectsData.model_validate(_load_test_data("projects")) assert len(projects) == 1 assert projects.get("accumulo") is not None + + +def test_retired_committee_data_model(): + retired_committees = RetiredCommitteeData.model_validate(_load_test_data("retired_committees")) + + assert retired_committees is not None + assert retired_committees.retired_count == 1 + + pmc = retired_committees.retired[0] + assert pmc.name == "abdera" + + +def _load_test_data(name: str) -> Any: + with open(os.path.join(os.path.dirname(__file__), "testdata", f"{name}.json")) as f: + return json.load(f) diff --git a/tests/datasources/testdata/committees.json b/tests/unit/datasources/testdata/committees.json similarity index 100% rename from tests/datasources/testdata/committees.json rename to tests/unit/datasources/testdata/committees.json diff --git a/tests/datasources/testdata/groups.json b/tests/unit/datasources/testdata/groups.json similarity index 100% rename from tests/datasources/testdata/groups.json rename to tests/unit/datasources/testdata/groups.json diff --git a/tests/datasources/testdata/ldap_projects.json b/tests/unit/datasources/testdata/ldap_projects.json similarity index 100% rename from tests/datasources/testdata/ldap_projects.json rename to tests/unit/datasources/testdata/ldap_projects.json diff --git a/tests/datasources/testdata/podlings.json b/tests/unit/datasources/testdata/podlings.json similarity index 100% rename from tests/datasources/testdata/podlings.json rename to tests/unit/datasources/testdata/podlings.json diff --git a/tests/datasources/testdata/projects.json b/tests/unit/datasources/testdata/projects.json similarity index 100% rename from tests/datasources/testdata/projects.json rename to tests/unit/datasources/testdata/projects.json diff --git a/tests/datasources/testdata/retired_committees.json b/tests/unit/datasources/testdata/retired_committees.json similarity index 100% rename from tests/datasources/testdata/retired_committees.json rename to tests/unit/datasources/testdata/retired_committees.json --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
