Skip to content

Defer quickstart Data/Query creation to runtime - #87

Open
anthonydellapia1117 wants to merge 1 commit into
uberfastman:mainfrom
anthonydellapia1117:anthonydellapia1117-open-yfpy-repo
Open

anthonydellapia1117 wants to merge 1 commit into
uberfastman:mainfrom
anthonydellapia1117:anthonydellapia1117-open-yfpy-repo

Conversation

@anthonydellapia1117

Copy link
Copy Markdown

Why

Importing scripts/quickstart.py caused pytest and other tooling to exit at import time when Yahoo API credentials were not present. This created an unexpected side effect: test collection and imports failed unless environment variables or credentials were set.

What changed

  • Move creation of Data and YahooFantasySportsQuery into a create_query() helper.
  • Instantiate Data and the query only when running the script directly (under if name == "main").

This prevents import-time OAuth work and avoids exiting during module import, allowing test discovery and other tooling to import quickstart.py safely.

Notes and testing

  • Unit test collection now succeeds without Yahoo credentials (integration tests still require credentials or Docker). 44 tests were deselected during a unit-only run.
  • No behavior changes when running the script directly; quickstart still constructs its Data/query and runs as before when executed.

If reviewers prefer a different helper name or placement, happy to adjust.

…OAuth side effects

This prevents pytest and other tooling from exiting during import when Yahoo credentials are not set.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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