-
Notifications
You must be signed in to change notification settings - Fork 4
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
Make this working with pytest? #12
Comments
Thanks for the suggestion. Unfortunately, I have no idea how I could even begin to address this. The AST transformation example is just a proof of concept. Of course, if one uses ideas to modify the AST and also uses pytest, which also does AST transformations as you point out, there is no guarantee that the two types of transformations will, in general, be compatible. And, as you show, they (currently) are not. Unfortunately, while it is an interesting suggestion, I will have to close this issue as being out of scope for this project, and beyond my capabilities. If you have concrete suggestions to offer as to how I might go about to address this, please feel free to reopen this issue. |
On Tue, Jun 08, 2021 at 03:53:53AM -0700, André Roberge wrote:
If you have concrete suggestions to offer as to how I might
go about to address this
Probably, pytest can adopt the ideas machinery to handle their
ast transformation. That was my initial guess, probably there
are other ways to handle this issue, maybe within the ideas project
itself.
If you are ok with this solution - I'll look into to provide a patch
(for pytest, but that might require some changes on the ideas side).
|
I would be ok with this solution. However, note that ideas is really just a toy project created by a dabbling amateur whereas pytest is an industry-grade project created by professional programmers: I would not be surprised at all if any patch submitted to pytest to solve this issue were to be rejected by the maintainers of that project. At the same time, I am open to anyone helping contributing to making ideas more robust and useful - and helping me learn more in doing so. |
Probably, so. But I would like to see huge number of If you do think this issue can't be solved in the ideas itself - feel free to close it. I'll open a PR if I find a way ;-) |
Just for record, I corrected the example - it was wrong. The problem happens only for invalid asserts: tracebacks aren't very helpfull. |
FYI: permission error can be fixed easily. In fact, I don't know why you open files for updating here: 'rb' mode seems to be more correct. Unfortunately, pytest's tracebacks aren't very helpful with the ideas:
BTW, I think you may change the API (at least for AST transformations, but, perhaps - for everything) to be like the IPython ast_transformers option. I.e. a list of AST transformations to easily combine them. Currently your users forced to make custom transform_ast() function, which essentially just run sequentially all transformations. This is merely a boilerplate code. If this does make sense for you - I'll open a separate issue. |
Reopening this issue to keep track of work to do. |
Take an example (ideas were installed from the git):
Great!
But pytest does some magic AST transformation with the assert statement. Thus for following:
new test blow up:
The text was updated successfully, but these errors were encountered: