Repository navigation
Move tests/ci/test_* unit tests into ci/tests/ so they run in CI - #109777
Merged
Merged
Conversation
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
Contributor
|
Workflow [PR], commit [8461294] Summary: ✅ AI ReviewSummaryThis PR moves the three new CI-related unit tests into Final Verdict
|
leshikus
marked this pull request as ready for review
July 8, 2026 13:56
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.
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.
maxknv
approved these changes
Jul 9, 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
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #109489
The CI unit-test job runs
pytest ci/tests/(seeci/jobs/ci_tests_job.py), so unit tests placed undertests/ci/are never executed in CI. Move the three recently added unit-test files there so they actually run:test_create_release.pytest_cherry_pick_branches.pytest_pr_version_info.pyEach module under test still lives in
tests/ci/and imports its siblings by bare name, so each test now puts that directory onsys.pathonly for the duration of the import and removes it afterwards, mirroring the existingci/tests/test_download_release_packages.py.Follow-up to a review comment on #109489.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):