Skip to content

test: serve S3 tests from a local moto server - #1695

Merged
ariostas merged 3 commits into
mainfrom
ariostas/update-s3-test-file-1693
Aug 7, 2026
Merged

test: serve S3 tests from a local moto server#1695
ariostas merged 3 commits into
mainfrom
ariostas/update-s3-test-file-1693

Conversation

@ariostas

@ariostas ariostas commented Aug 4, 2026

Copy link
Copy Markdown
Member

Closes #1693.

🤖 AI text below 🤖

The S3 tests were reading pythia_ppZee_run17emb.picoDst.root (872 MB) out of the pivarski-princeton bucket on every CI run, which is running up data transfer charges for its owner. That file is moving to Zenodo and will be deleted from AWS on August 31, 2026.

It was the only object in that bucket, and all three tests using it exist to exercise the s3:// protocol, so the new Zenodo HTTPS URL isn't a substitute. Instead of repointing them at another remote copy, this runs them against an in-process moto S3 server.

  • New session-scoped s3_server fixture in tests/conftest.py (alongside the existing http_server / xrootd_server fixtures): starts ThreadedMotoServer on an ephemeral port, creates a bucket, and uploads two copies of uproot-HZZ.root from skhep_testdata. It yields (bucket_url, storage_options), with fake key/secret passed explicitly so a developer's real AWS credentials are never picked up.
  • test_s3_fail, test_read_s3, test_open_fsspec_s3, and test_fsspec_globbing_s3 now use the fixture. The globbing test asserts 2 matches in a bucket the fixture controls, rather than depending on the remote bucket's contents not changing.
  • Dropped @pytest.mark.network from these tests — they're local now, and run in ~2.5s.
  • Added moto[s3,server] to the test dependency group.

No reference to the pivarski-princeton bucket remains in the repo.

The one trade-off: we no longer read a real remote S3 object anywhere in the test suite. If that's worth keeping, the Zenodo URL could be added as an https:// fsspec test, but it can't cover the s3:// path.

🤖 Generated with Claude Code

The S3 tests read pythia_ppZee_run17emb.picoDst.root (872 MB) out of the
`pivarski-princeton` bucket on every CI run, which is running up data
transfer charges for its owner; the file is being moved to Zenodo and will
be deleted from AWS on August 31, 2026 (#1693).

Rather than repoint the tests at another remote copy, run them against an
in-process moto S3 server populated with a small skhep_testdata file. This
removes the last use of that bucket, keeps coverage of the s3:// protocol
(open, storage-option pass-through, and globbing), and makes the tests
local, so they no longer need the `network` marker.

Closes #1693

Assisted-by: claude-code:claude-opus-5[1m]
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.89%. Comparing base (3c515ad) to head (9511b94).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files

see 3 files with indirect coverage changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the test suite’s S3 coverage to run against a local in-process moto S3 server instead of reading a large object from a public AWS bucket, reducing CI network dependence and avoiding ongoing S3 egress charges.

Changes:

  • Add a session-scoped s3_server fixture that boots a ThreadedMotoServer, creates a bucket, and uploads two uproot-HZZ.root copies for deterministic S3 test inputs.
  • Update S3-related tests to use the local moto-backed bucket and adjust assertions (including globbing expecting exactly two matches).
  • Add moto[s3,server] to the test dependency group.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
tests/test_0916_read_from_s3.py Switch S3 read/fail tests from remote AWS bucket to the local s3_server fixture.
tests/test_0692_fsspec_reading.py Update fsspec S3 open/globbing tests to target the moto-backed bucket and assert deterministic results.
tests/conftest.py Introduce s3_server session fixture that provisions and populates a local moto S3 service.
pyproject.toml Add moto server/S3 extra to the test dependency group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/conftest.py Outdated
On free-threaded Windows, moto[server] -> docker -> pywin32 has no wheels, so
uv backtracks to moto 4.1.4, which has no ThreadedMotoServer.get_host_and_port
and errored out the S3 tests. Skip them there instead.

Assisted-by: claude-code:claude-opus-5[1m]
@ariostas
ariostas force-pushed the ariostas/update-s3-test-file-1693 branch from ba7c387 to 53791cf Compare August 4, 2026 18:36
Only the ThreadedMotoServer construction and start() are outside the
try/finally now, so a failure in port discovery or bucket setup can no longer
leave the server thread running.

Assisted-by: claude-code:claude-opus-5[1m]
@ariostas
ariostas requested a review from ianna August 4, 2026 18:41

@ianna ianna left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ariostas - Great! Thanks for fixing it.

@ariostas
ariostas merged commit 79369af into main Aug 7, 2026
26 checks passed
@ariostas
ariostas deleted the ariostas/update-s3-test-file-1693 branch August 7, 2026 17:55
@TaiSakuma TaiSakuma added the type/test PR title type: test (set automatically) label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/test PR title type: test (set automatically)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Moving pythia_ppZee_run17emb.picoDst.root

4 participants