Skip to content

Move tests/ci/test_* unit tests into ci/tests/ so they run in CI - #109777

Merged
leshikus merged 5 commits into
ClickHouse:masterfrom
leshikus:move-ci-tests
Jul 10, 2026
Merged

leshikus merged 5 commits into
ClickHouse:masterfrom
leshikus:move-ci-tests

Conversation

@leshikus

@leshikus leshikus commented Jul 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #109489

The CI unit-test job runs pytest ci/tests/ (see ci/jobs/ci_tests_job.py), so unit tests placed under tests/ci/ are never executed in CI. Move the three recently added unit-test files there so they actually run:

  • test_create_release.py
  • test_cherry_pick_branches.py
  • test_pr_version_info.py

Each module under test still lives in tests/ci/ and imports its siblings by bare name, so each test now puts that directory on sys.path only for the duration of the import and removes it afterwards, mirroring the existing ci/tests/test_download_release_packages.py.

Follow-up to a review comment on #109489.

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

The CI unit-test job runs `pytest ci/tests/` (see `ci/jobs/ci_tests_job.py`),
so unit tests placed under `tests/ci/` were never executed in CI. Move the
three recently added unit-test files there:

- `test_create_release.py`
- `test_cherry_pick_branches.py`
- `test_pr_version_info.py`

Each module under test still lives in `tests/ci/` and imports its siblings by
bare name, so the import puts that directory on `sys.path` only for the
duration of the import and removes it afterwards, mirroring the existing
`ci/tests/test_download_release_packages.py`.

Follow-up to ClickHouse#109489
@clickhouse-gh

clickhouse-gh Bot commented Jul 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8461294]

Summary: ✅


AI Review

Summary

This PR moves the three new CI-related unit tests into ci/tests/ so the CI Tests job actually executes them, and it extracts is_empty_patch_release into the dependency-light ci/jobs/scripts/release_checks.py helper so test_create_release.py no longer imports the full release toolchain. The current code resolves the earlier import-time dependency problem, the moved tests execute cleanly as plain unittest modules, and I did not find remaining correctness or CI-reliability issues in the diff.

Final Verdict
  • Status: ✅ Approve

@leshikus leshikus added the can be tested Allows running workflows for external contributors label Jul 8, 2026
@leshikus leshikus changed the title Move tests/ci/test_* unit tests into ci/tests/ Move tests/ci/test_* unit tests into ci/tests/ so they run in CI Jul 8, 2026
@leshikus
leshikus marked this pull request as ready for review July 8, 2026 13:56
@leshikus
leshikus requested a review from maxknv July 8, 2026 13:56
@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 8, 2026
Comment thread ci/tests/test_create_release.py Resolved
Importing `create_release` pulls in `github_helper`/`get_robot_token`, which
do a top-level `from github import ...`. The CI Tests docker image does not
ship PyGithub, so the test errored on collection with
`ModuleNotFoundError: No module named 'github'`.

Install PyGithub on demand as a stopgap. A FIXME records the proper fix:
breaking the import-time PyGithub dependency of the `create_release` chain
(lazy imports, as `pr_version_info` already does), or replacing PyGithub with
praktika's `gh`-CLI wrapper.
Comment thread ci/tests/test_create_release.py Resolved
leshikus added 2 commits July 9, 2026 02:13
The moved test imported `create_release.ReleaseInfo`, which pulls in the
whole release toolchain (`unidiff`, `github` via `get_robot_token`,
`boto3` via `s3_helper`) at import time -- none of which ships in the
`CI Tests` docker image. The stopgap `pip install PyGithub` at collection
time was both non-hermetic (depends on live PyPI and the latest PyGithub
release) and insufficient (collection still failed on `unidiff`).

Extract the pure `is_empty_patch_release` helper into a new dependency-light
module `release_checks.py`, have `ReleaseInfo.prepare` call it, and import it
directly from the test. The test now runs in CI without installing anything.
Place the dependency-light `is_empty_patch_release` guard in
`ci/jobs/scripts/release_checks.py`, next to the other CI job scripts and
where the `ci/tests/` suite imports its subjects as `ci.jobs.scripts.*`. The
test now imports it directly with no `sys.path` juggling.

`tests/ci/create_release.py` runs as `python3 ./tests/ci/create_release.py`,
so its own directory is on `sys.path` and repo root is not (hence its bare
sibling imports). It now adds repo root and imports the guard lazily inside
`ReleaseInfo.prepare`, mirroring how `pr_version_info.py` lazily imports
`ci.jobs.scripts.*`. The helper has no imports of its own, so pulling it in
triggers none of the release stack.
@leshikus
leshikus added this pull request to the merge queue Jul 10, 2026
Merged via the queue into ClickHouse:master with commit c3567c1 Jul 10, 2026
175 checks passed
@leshikus
leshikus deleted the move-ci-tests branch July 10, 2026 11:35
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 10, 2026
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Move tests/ci/test_* unit tests into ci/tests/ so they run in CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-ci pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants