Skip to content
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

[BUG] Incorrect timeout setting for call_and_validate #1758

Open
2 tasks done
gosuvn opened this issue Jul 26, 2023 · 1 comment
Open
2 tasks done

[BUG] Incorrect timeout setting for call_and_validate #1758

gosuvn opened this issue Jul 26, 2023 · 1 comment
Assignees
Labels
Component: CLI Command line interface Type: Breaking Change Introduces changes incompatible with previous versions Type: Bug Errors or unexpected behavior
Milestone

Comments

@gosuvn
Copy link

gosuvn commented Jul 26, 2023

Checklist

Describe the bug
Timeout is in second for call_and_validate function.

To Reproduce
Steps to reproduce the behavior:

Use the function response = case.call(verify=False, timeout=30000)

Expected behavior
Timeout supports to be millisecond but Schemathesis use it as second.
It use millisecond for the default setting, even convert to second back for the exception.
If we pass in millisecond, the timeout will be too long.
If we pass in second, the exception will print out incorrect value.
See :

data.setdefault("timeout", DEFAULT_RESPONSE_TIMEOUT / 1000)

Environment (please complete the following information):

  • OS: Debian WSL
  • Python version: 3.8.10
  • Schemathesis version: 3.19.5
  • Spec version: 3.0.3

Additional context
We should convert it to second from millisecond like in this commit 3b5c699

@gosuvn gosuvn added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior labels Jul 26, 2023
@gosuvn gosuvn changed the title [BUG] [BUG] Incorrect timeout setting for call_and_validate Jul 26, 2023
@Stranger6667 Stranger6667 modified the milestones: 3.21, 3.20 Oct 9, 2023
@Stranger6667
Copy link
Member

That's a design bug I made as it leads to discrepancy:

  • call / call_and_validate aim to be thin proxies around the underlying transports, so users can pass any keyword arguments that are supported by the transport as they are. Python's requests expects timeout in seconds.
  • Apparently, I thought that curl takes a timeout in milliseconds and implemented it in CLI this way. But it also uses seconds

-m, --max-time Maximum time allowed for transfer

httpie also uses seconds:

--timeout SECOND

So, I think that the better approach would be to change the CLI option, but it will be a breaking change.

@Stranger6667 Stranger6667 added Breaking and removed Status: Needs Triage Requires initial assessment to categorize and prioritize labels Oct 11, 2023
@Stranger6667 Stranger6667 modified the milestones: 3.20, 4.0 Oct 11, 2023
@Stranger6667 Stranger6667 added Type: Breaking Change Introduces changes incompatible with previous versions Component: CLI Command line interface and removed Breaking labels Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: CLI Command line interface Type: Breaking Change Introduces changes incompatible with previous versions Type: Bug Errors or unexpected behavior
Projects
None yet
Development

No branches or pull requests

2 participants