Skip to content

🧪 Add mocked tests for name2uniprot in pathwaycommons - #58

Closed
akutuva21 wants to merge 3 commits into
mainfrom
bolt-testing-name2uniprot-15794140290505221084
Closed

akutuva21 wants to merge 3 commits into
mainfrom
bolt-testing-name2uniprot-15794140290505221084

Conversation

@akutuva21

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed
The name2uniprot function in bionetgen/atomizer/utils/pathwaycommons.py was missing test coverage. Because it makes HTTP requests to UniProt to fetch IDs, it needed to be tested using mocked calls to ensure deterministic and safe testing.

📊 Coverage: What scenarios are now tested

  1. Happy path with organism filter: Calling name2uniprot with a valid organism correctly passes the parameter to UniProt and parses the response.
  2. Happy path without organism filter: Calling name2uniprot without an organism makes the HTTP request correctly without the organism query parameter.
  3. Fallback handling: If the specific query (with organism) yields no results, it falls back to a generic query.
  4. HTTPError (First Call): Capturing and logging an HTTPError during the first connection attempt.
  5. HTTPError (Fallback Call): Graceful handling when the fallback connection throws an HTTPError.

✨ Result: The improvement in test coverage
The name2uniprot function now has 100% path coverage for its active implementation. Since the development sandbox has complex import dependencies (like cement and sympy), the tests use importlib and scoped sys.modules patching via a custom pytest fixture to ensure complete test isolation and zero global state pollution for the rest of the test suite.


PR created automatically by Jules for task 15794140290505221084 started by @akutuva21

Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits April 9, 2026 21:07
Co-authored-by: akutuva21 <44119804+akutuva21@users.noreply.github.com>
@akutuva21

Copy link
Copy Markdown
Owner Author

Superseded by #60 pathwaycommons HTTPError test coverage.

@akutuva21 akutuva21 closed this Apr 13, 2026
@google-labs-jules

Copy link
Copy Markdown

Superseded by #60 pathwaycommons HTTPError test coverage.

Understood. Acknowledging that this work is superseded and stopping work on this task.

akutuva21 pushed a commit that referenced this pull request Jun 1, 2026
Drop distutils for Python 3.12 compatibility (closes #58)
akutuva21 pushed a commit that referenced this pull request Jun 5, 2026
Packaging (B3): add extras_require={"bngsim": ["bngsim>=0.9.10"]} so the
optional in-process engine is discoverable via `pip install bionetgen[bngsim]`,
while keeping bngsim out of install_requires (never a hard dependency). The
extra's floor matches MINIMUM_BNGSIM_VERSION in the bridge.

Bridge: bump MINIMUM_BNGSIM_VERSION 0.6.0 -> 0.9.10. 0.9.0 settled the
method-independent gdat/scan output schema (bngsim #58) the parity differ
normalizes against; 0.9.10 is the current validated release. Refresh the
floor-rationale comment, which still cited the stale 0.6.0/#40 reason.
Update the version-guard test's minimum-version case to 0.9.10.

With bngsim absent the bridge soft-imports to the legacy subprocess path
unchanged; the bngsim test files skip/pass cleanly (239 passed, 9 skipped,
0 errors with bngsim genuinely uninstalled).
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.

1 participant