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

Better error messages for hypothesis write <some_filename> #3404

Closed
2 tasks
Zac-HD opened this issue Jul 15, 2022 · 0 comments · Fixed by #3415
Closed
2 tasks

Better error messages for hypothesis write <some_filename> #3404

Zac-HD opened this issue Jul 15, 2022 · 0 comments · Fixed by #3415
Labels
legibility make errors helpful and Hypothesis grokable

Comments

@Zac-HD
Copy link
Member

Zac-HD commented Jul 15, 2022

The Ghostwriter CLI expects to be passed a module name (e.g. hypothesis write gzip), or dotted path to a callable (e.g. hypothesis write numpy.matmul). We also include the current directory in the python path, so that you can pass e.g. myscript.

If you try passing a filename instead, this doesn't work - whether myscript.py or path/to/myscript.py. I don't want to make that work, but we could have better error messages:

  • hypothesis write myscript.py fails with Error: Found the 'script' module, but it doesn't have a 'py' attribute. In this case, we should add "\n Remember that the ghostwriter should be passed the name of a module, not a file"
  • hypothesis write src/myscript.py fails with Error: Invalid value for 'FUNC...': my/script.py. We should add a similar explicit error message.
@Zac-HD Zac-HD added the legibility make errors helpful and Hypothesis grokable label Jul 15, 2022
@Zac-HD Zac-HD mentioned this issue Jul 15, 2022
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legibility make errors helpful and Hypothesis grokable
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant