Skip to content

refactor(pyamber): move tests to src/test/python to match Maven layout#4945

Merged
Yicong-Huang merged 2 commits intoapache:mainfrom
Yicong-Huang:chore/move-python-tests-to-src-test
May 6, 2026
Merged

refactor(pyamber): move tests to src/test/python to match Maven layout#4945
Yicong-Huang merged 2 commits intoapache:mainfrom
Yicong-Huang:chore/move-python-tests-to-src-test

Conversation

@Yicong-Huang
Copy link
Copy Markdown
Contributor

@Yicong-Huang Yicong-Huang commented May 5, 2026

What changes were proposed in this PR?

Move Python tests from amber/src/main/python/ (co-located with production) to amber/src/test/python/ (Maven source-set sibling), aligning with the Scala layout already used by amber (src/main/scala + src/test/scala). pyproject.toml moves up to amber/ 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) only COPY src/main/python into 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 pytest from amber/ collects 462 tests — same set as before. Ruff check and format --check both clean on src/main/python and src/test/python. Five test_large_binary_manager failures are pre-existing on upstream/main (S3 / boto setup, unrelated).

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 4.7 (Claude Code)

@github-actions github-actions Bot added engine dependencies Pull requests that update a dependency file python ci changes related to CI dev labels May 5, 2026
@Yicong-Huang Yicong-Huang force-pushed the chore/move-python-tests-to-src-test branch from a3b0d95 to fcca593 Compare May 5, 2026 14:53
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.49%. Comparing base (41a8197) to head (8aaadf7).
⚠️ Report is 1 commits behind head on main.

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     
Flag Coverage Δ
access-control-service 39.53% <ø> (ø)
agent-service 33.72% <ø> (ø)
amber 43.13% <ø> (-0.01%) ⬇️
computing-unit-managing-service 0.00% <ø> (ø)
config-service 0.00% <ø> (ø)
file-service 33.24% <ø> (ø)
frontend 32.27% <ø> (ø)
python 88.06% <ø> (ø)
workflow-compiling-service 47.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang Yicong-Huang force-pushed the chore/move-python-tests-to-src-test branch from fcca593 to cb43672 Compare May 5, 2026 14:55
@Yicong-Huang Yicong-Huang requested a review from aglinxinyuan May 5, 2026 14:57
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
@Yicong-Huang Yicong-Huang force-pushed the chore/move-python-tests-to-src-test branch from cb43672 to bd78270 Compare May 5, 2026 15:05
@Yicong-Huang Yicong-Huang changed the title chore(pyamber): move tests to src/test/python to match Maven layout refactor(pyamber): move tests to src/test/python to match Maven layout May 5, 2026
Copy link
Copy Markdown
Contributor

@aglinxinyuan aglinxinyuan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. It's a very nice PR!

@Yicong-Huang Yicong-Huang enabled auto-merge (squash) May 5, 2026 23:55
@Yicong-Huang Yicong-Huang merged commit b0ee3b7 into apache:main May 6, 2026
23 checks passed
@Yicong-Huang Yicong-Huang deleted the chore/move-python-tests-to-src-test branch May 6, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci changes related to CI dependencies Pull requests that update a dependency file dev engine python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move Python tests from src/main/python to src/test/python to align with Maven layout

3 participants