-
Notifications
You must be signed in to change notification settings - Fork 37
feat: allow float timeouts in the clientconfig #2671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -89,6 +89,7 @@ def make_cognite_client() -> CogniteClient: | |
| project=os.environ["COGNITE_PROJECT"], | ||
| base_url=os.environ["COGNITE_BASE_URL"], | ||
| credentials=credentials, | ||
| timeout=59.9, # Test that a non-int timeout works | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Relying on the global integration test client configuration to verify that float timeouts work is not a robust testing strategy. It doesn't explicitly assert the behavior and could be easily lost or modified in the future.\n\nPlease add a dedicated unit test (e.g., in |
||
| ) | ||
| ) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While updating the type hint of
timeouttofloat | None, please note that the current implementation in__init__usesself.timeout = timeout or 60. Since0.0is a falsy value in Python, passingtimeout=0.0(which is a valid float timeout for non-blocking/immediate timeout) will be incorrectly overridden to60.\n\nTo fix this correctness issue, the assignment should be updated to:\npython\nself.timeout = 60 if timeout is None else timeout\n\n\nAdditionally, for consistency and completeness,file_transfer_timeoutshould also be updated to supportfloat | Noneinstead of strictlyint | None.References