Skip to content

PD-97 Add unit test to check CLI/pypfb import#285

Open
paulineribeyre wants to merge 20 commits intomasterfrom
chore/cli-pfb-test
Open

PD-97 Add unit test to check CLI/pypfb import#285
paulineribeyre wants to merge 20 commits intomasterfrom
chore/cli-pfb-test

Conversation

@paulineribeyre
Copy link
Contributor

@paulineribeyre paulineribeyre commented Jan 2, 2026

Regression test for:

Traceback (most recent call last):
  File "/Users/kyle/.pyenv/versions/3.13.4/bin/gen3", line 5, in <module>
    from gen3.cli.__main__ import main
  File "/Users/kyle/.pyenv/versions/3.13.4/lib/python3.13/site-packages/gen3/cli/__main__.py", line 9, in <module>
    import gen3.cli.pfb as pfb
  File "/Users/kyle/.pyenv/versions/3.13.4/lib/python3.13/site-packages/gen3/cli/pfb.py", line 2, in <module>
    from pfb import cli as pfb_cli
  File "/Users/kyle/.pyenv/versions/3.13.4/lib/python3.13/site-packages/pfb/cli.py", line 63, in <module>
    for ep in entry_points().get("pfb.plugins", []):
              ^^^^^^^^^^^^^^^^^^

Link to JIRA ticket if there is one: https://ctds-planx.atlassian.net/browse/PD-97

New Features

Breaking Changes

Bug Fixes

  • Fixes issue with SDK running in python 3.9

Improvements

Dependency updates

Deployment changes

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

The style in this PR agrees with black. ✔️

This formatting comment was generated automatically by a script in uc-cdis/wool.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

filepath passed skipped SUBTOTAL
tests/test_presigned_url.py 7 0 7
tests/test_graph_submit_and_query.py 13 1 14
tests/test_data_upload.py 8 1 9
TOTAL 28 2 30

Please find the detailed integration test report here

Please find the Github Action logs here

Update test_cli to assert SystemExit 0
@github-actions
Copy link

github-actions bot commented Feb 3, 2026

filepath passed error skipped SUBTOTAL
tests/test_presigned_url.py 7 0 0 7
tests/test_graph_submit_and_query.py 13 0 1 14
tests/test_data_upload.py 8 1 1 10
TOTAL 28 1 2 31

Please find the detailed integration test report here

Please find the Github Action logs here

@github-actions
Copy link

github-actions bot commented Feb 3, 2026

filepath passed skipped SUBTOTAL
tests/test_data_upload.py 8 1 9
TOTAL 8 1 9

Please find the detailed integration test report here

Please find the Github Action logs here

import pytest


def test_import_cli(monkeypatch):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
def test_import_cli(monkeypatch):
def test_import_cli(monkeypatch):
"""
Test that invoking the help from the CLI does not return an error
"""

# Load plug-ins from entry_points (syntax changes for python 3.12+)
major = sys.version_info[0]
minor = sys.version_info[1]
if major == 3 and minor >= 12:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would much rather try/catch than explicitly name major and minor versions in the code, but I don't feel super strongly about it. It's just that if in the long long future Python releases a 4 major, this is going to break again.

Comment on lines +354 to +358
for ep in entry_points(group="pfb.plugins"):
ep.load()
else:
for ep in entry_points().get("pfb.plugins", []):
ep.load()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i didn't look into how this works exactly, but it looks off to me that it's hardcoded to pfb.plugins here and called in both gen3/cli/pfb.py and gen3/cli/users.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants