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] --report flag without arguments is broken. #1753

Closed
2 tasks done
phknot opened this issue Jul 7, 2023 · 3 comments · Fixed by #1760
Closed
2 tasks done

[BUG] --report flag without arguments is broken. #1753

phknot opened this issue Jul 7, 2023 · 3 comments · Fixed by #1760
Assignees
Labels
Difficulty: Intermediate Requires some experience Priority: High Important but not urgent Type: Bug Errors or unexpected behavior

Comments

@phknot
Copy link

phknot commented Jul 7, 2023

Checklist

Describe the bug
When running from the CLI with the --report flag an error is thrown. When adding any arguments like true or 1, a file with that name is created. I would like a report on schemathesis.io to be generated.

To Reproduce
Steps to reproduce the behavior:

Run a valid schemathesis command with the --report flag

The error received is the following:

Traceback (most recent call last):
  File "/home/docker/.local/bin/st", line 8, in <module>
    sys.exit(schemathesis())
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 1686, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 943, in make_context
    self.parse_args(ctx, args)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 1408, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 2400, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 2356, in process_value
    value = self.type_cast_value(ctx, value)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 2344, in type_cast_value
    return convert(value)
  File "/home/docker/.local/lib/python3.8/site-packages/click/core.py", line 2316, in convert
    return self.type(value, param=self, ctx=ctx)
  File "/home/docker/.local/lib/python3.8/site-packages/click/types.py", line 83, in __call__
    return self.convert(value, param, ctx)
  File "/home/docker/.local/lib/python3.8/site-packages/click/types.py", line 712, in convert
    lazy = self.resolve_lazy_flag(value)
  File "/home/docker/.local/lib/python3.8/site-packages/click/types.py", line 694, in resolve_lazy_flag
    if os.fspath(value) == "-":
TypeError: expected str, bytes or os.PathLike object, not object

Expected behavior
--report with no flags should upload a report to schemathesis.io

Environment (please complete the following information):

  • OS: Debian WSL
  • Python version: 3.8.10
  • Schemathesis version: 3.19.5
  • Spec version: 3.0.3
@phknot phknot added Status: Needs Triage Requires initial assessment to categorize and prioritize Type: Bug Errors or unexpected behavior labels Jul 7, 2023
@dd-ssc
Copy link

dd-ssc commented Aug 5, 2023

Same issue here, different environment:

  • OS: macOS 13.4.1
  • Python version: 3.10.12
  • Schemathesis version: 3.19.5
  • Spec version: no idea

I've been trying out schemathesis first time today, followed the instructions to the letter and encountered this uncaught exception. Guess I'll stop trying, remove my API and close my account.

@Stranger6667 Stranger6667 added Priority: High Important but not urgent Difficulty: Intermediate Requires some experience and removed Status: Needs Triage Requires initial assessment to categorize and prioritize labels Aug 5, 2023
@Stranger6667
Copy link
Member

For reference - the exception happens with ‘click’ > 8.1.3 (starting from this commit). Schemathesis relied on previous behaviour in order to support both variants of using this CLI option, with and without a value. I am going to work on a fix somewhere next week when I am back from vacation, a temporary solution could be to pin the ‘click’ version to 8.1.3.

@phknot
Copy link
Author

phknot commented Aug 29, 2023

Thanks for fixing, now my other devs don't need to bug me to read the logs for them anymore when they break the spec again ;D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Difficulty: Intermediate Requires some experience Priority: High Important but not urgent Type: Bug Errors or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants