Zac-HD / shed

`shed` canonicalises Python code. Shed your legacy, stop bikeshedding, and move on. Black++
https://pypi.org/project/shed/
GNU Affero General Public License v3.0
342 stars 23 forks source link

Internal errors when running on pytest with `--refactor` #35

Closed The-Compiler closed 2 years ago

The-Compiler commented 2 years ago

With shed 0.9.5 and Python 3.10.4, running shed --refactor over pytest, I get:

Internal error formatting 'doc/en/example/pythoncollection.rst': SyntaxError: multiple exception types must be parenthesized (<unknown>, line 5)
    Please report this to https://github.com/Zac-HD/shed/issues
Internal error formatting 'doc/en/how-to/writing_plugins.rst': SyntaxError: positional argument follows keyword argument (<unknown>, line 1)
    Please report this to https://github.com/Zac-HD/shed/issues
Zac-HD commented 2 years ago

This is genuinely invalid syntax in the pytest docs' example code, but you're correct that shed should handle that better.

glnnlhmn commented 2 years ago

Investigated this issue during mentored sprints at PyCon 2022. Reproduced the error by placing a syntax error in writing_plugins.rst and running shed over the file.

The invalid code block invoked pytest import handling in a way that created an error.

Spoke with Zac and determined the issue is not worth handling, and the current behavior is acceptable.

Zac-HD commented 2 years ago

Thanks Glenn - this was surprisingly gnarly to track down, so I'm glad we got to the bottom of it 😃