Skip to content

Add tests for Julia metadata handling - #1143

Merged
Luciano Bello (1ucian0) merged 4 commits into
Qiskit:mainfrom
snoopuppy582:test/julia-coverage
Jun 19, 2026
Merged

Luciano Bello (1ucian0) merged 4 commits into
Qiskit:mainfrom
snoopuppy582:test/julia-coverage

Conversation

@snoopuppy582

Copy link
Copy Markdown
Contributor

Summary

Adds JuliaData unit coverage for URL parsing, serialized metadata, JuliaHub URL probing, General registry lookup, download statistics, and update_json orchestration.

Fixes #1106.

Details and comments

The tests mock network calls so they do not depend on JuliaHub, JuliaPackages, the General registry, or Julia download-stat endpoints being reachable during test runs.

Local coverage for ecosystem/julia.py increases to 91% with the new focused tests.

Tests run:

  • uv run --python 3.13 ... pytest tests/models/test_julia.py -q
  • uv run --python 3.13 ... pytest tests/models -q
  • uv run --python 3.13 ... coverage run --source=ecosystem.julia -m unittest tests.models.test_julia && coverage report -m
  • uv run --python 3.13 --with black[jupyter]~=26.3 black --check tests/models/test_julia.py
  • uv run --python 3.13 ... pylint -rn tests/models/test_julia.py
  • git diff --check

@CLAassistant

CLAassistant commented May 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@snoopuppy582

Copy link
Copy Markdown
Contributor Author

good

@1ucian0 Luciano Bello (1ucian0) 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.

Thanks!

Tests should mock network interactions, so they do not fail on network issues. Have a look to #1138 as an example.

@snoopuppy582

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I tightened the Julia metadata tests so every ecosystem.julia.request_json call now goes through a strict URL-to-payload mock. If the code tries any unexpected URL, the test raises an assertion instead of silently returning a fallback value. The tests also assert the exact mocked request sequence for the JuliaHub, registry, download stats, and GitHub tree probes.

Verified locally:

  • python -m unittest tests.models.test_julia -v
  • python -m black --check tests/models/test_julia.py
  • python -m pylint -rn tests/models/test_julia.py

@1ucian0 Luciano Bello (1ucian0) 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.

why Flux? :)

I think there are more points where mocking can be implemented.

Comment thread tests/models/test_julia.py Resolved
Comment thread tests/models/test_julia.py Resolved
Comment thread tests/models/test_julia.py Resolved
@snoopuppy582

Copy link
Copy Markdown
Contributor Author

Thanks, I pushed a follow-up in 2fb327a to address both points.

Changes:

  • replaced the real-looking Flux fixture with a synthetic BananaCompiler Julia package so the tests do not look tied to a specific real package
  • moved the tests that were setting private Julia metadata state directly onto mocked request_json plus the public update_json() path
  • kept the strict ordered URL mock, so any unexpected JuliaPackages, JuliaHub, registry, stats, or GitHub tree request fails the test

Verified locally:

  • python -m unittest tests.models.test_julia -v
  • python -m unittest discover -s tests/models -v
  • python -m coverage run --source=ecosystem.julia -m unittest tests.models.test_julia && python -m coverage report -m -> ecosystem/julia.py at 91%
  • python -m black --check tests/models/test_julia.py
  • python -m pylint -rn tests/models/test_julia.py
  • git diff --check

Comment thread tests/test_julia.py Resolved

@1ucian0 Luciano Bello (1ucian0) 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.

Thanks! LGTM

Comment thread tests/test_julia.py Resolved
@1ucian0
Luciano Bello (1ucian0) added this pull request to the merge queue Jun 19, 2026
Merged via the queue into Qiskit:main with commit 1447dee Jun 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

increase test coverage of ecosystem/julia.py

3 participants