Skip to content

fix config: honor explicit args instead of returning cached default - #166

Open
Tyagiquamar wants to merge 1 commit into
upstox:masterfrom
Tyagiquamar:fix/configuration-honor-explicit-args
Open

Tyagiquamar wants to merge 1 commit into
upstox:masterfrom
Tyagiquamar:fix/configuration-honor-explicit-args

Conversation

@Tyagiquamar

Copy link
Copy Markdown

What changed

  • upstox_client/configuration.py: TypeWithDefault.__call__ now constructs a fresh Configuration when explicit args/kwargs are passed, instead of always returning a copy of the first-cached default. Bare Configuration() calls keep the existing cached-default behavior, and ApiClient (which calls Configuration() with no args) is unaffected.
  • Added test/test_configuration.py with 4 network-free unit tests.

Why

Fixes #155. Once any Configuration() was created (e.g. live), a later Configuration(sandbox=True) silently returned a copy of the live config, so sandbox endpoints were never used unless callers hand-patched host/order_host.

Testing

Docker python:3.11-bookworm:

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.

Configuration Class behaves as a Singleton, ignoring subsequent __init__ arguments

1 participant