refactor(pyamber): move tests to src/test/python to match Maven layout#4945
Merged
Yicong-Huang merged 2 commits intoapache:mainfrom May 6, 2026
Merged
Conversation
a3b0d95 to
fcca593
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4945 +/- ##
============================================
- Coverage 42.50% 42.49% -0.01%
+ Complexity 2181 2180 -1
============================================
Files 1005 1005
Lines 37429 37429
Branches 3914 3914
============================================
- Hits 15908 15907 -1
Misses 20558 20558
- Partials 963 964 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fcca593 to
cb43672
Compare
Aligns Python with the Scala source-set layout already used by amber:
production code in `src/main/python`, tests in `src/test/python`. The
forward-looking comment in `amber/build.sbt` already anticipated this
move.
- `git mv` 48 `test_*.py` files preserving package structure.
- Convert 7 test files from relative imports (`from .x import Y`) to
absolute paths now that the test tree is no longer a sibling of the
production module.
- Drop the hardcoded `core.util.expression_evaluator.test_expression_evaluator`
prefix in test_evaluate_object_expression — use `A.__module__` so the
assertion tracks whatever the test file's import path resolves to.
- Move `pyproject.toml` from `src/main/python/` to `amber/` so a single
config sits at the module root (mirroring `amber/build.sbt` for Scala).
- Add `[tool.pytest.ini_options]` with `pythonpath = ["src/main/python"]`,
`testpaths = ["src/test/python"]`, and `--import-mode=importlib` so
test modules don't need `__init__.py` mirrors and don't collide with
the production package namespace.
- CI: invoke ruff + pytest from `amber/` with explicit `src/{main,test}/python`
paths; codecov uploads from `./amber/coverage.xml`.
- `bin/fix-format.sh` collapses to a single `cd amber && ruff format
src/main/python src/test/python`.
Closes apache#4943
cb43672 to
bd78270
Compare
aglinxinyuan
approved these changes
May 5, 2026
Contributor
aglinxinyuan
left a comment
There was a problem hiding this comment.
Thanks. It's a very nice PR!
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.
What changes were proposed in this PR?
Move Python tests from
amber/src/main/python/(co-located with production) toamber/src/test/python/(Maven source-set sibling), aligning with the Scala layout already used by amber (src/main/scala+src/test/scala).pyproject.tomlmoves up toamber/so a single Python config sits at the module root.Side benefit: the runtime Docker images (
bin/computing-unit-master.dockerfile,bin/computing-unit-worker.dockerfile) onlyCOPY src/main/pythoninto the production stage, so 48 test files no longer ship to production runtime images.Any related issues, documentation, discussions?
Closes #4943.
How was this PR tested?
Local
pytestfromamber/collects 462 tests — same set as before. Ruffcheckandformat --checkboth clean onsrc/main/pythonandsrc/test/python. Fivetest_large_binary_managerfailures are pre-existing onupstream/main(S3 / boto setup, unrelated).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.7 (Claude Code)