Repository navigation
Implement #2750: Run black+isort on gen_exports results - #2759
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2759 +/- ##
=======================================
Coverage 98.94% 98.94%
=======================================
Files 113 113
Lines 16843 16870 +27
Branches 3036 3041 +5
=======================================
+ Hits 16665 16692 +27
Misses 123 123
Partials 55 55
|
We don't have black/isort installed, not very useful.
|
Adding this caused all the pypy tests to fail, since we don't even install black/isort there. I just skipped the tests there, the module is an internal tool that only needs to run on one version. |
|
needs |
|
Hmm actually I could just add tests for those cases - mock out |
sure .. but do we need thorough tests on an internal code generation tool? :p |
A5rocks
left a comment
There was a problem hiding this comment.
Couple of nitpicks, looks good otherwise.
| traceback.print_exception(type(exc), exc, exc.__traceback__) | ||
| sys.exit(1) |
There was a problem hiding this comment.
Why can't we re-raise? Or even raise RuntimeError("Failed to run isort!") from exc!
(same for black)
There was a problem hiding this comment.
I don't think that results in a nonzero exit code, I wanted to make sure CI etc fails.
There was a problem hiding this comment.
FWIW it does, it seems!
a5@hostname:/tmp$ python3 t.py
Traceback (most recent call last):
File "t.py", line 1, in <module>
raise Exception("hi!")
Exception: hi!
a5@hostname:/tmp$ echo $?
1(at least on my Ubuntu WSL env...)
|
builds.sr.ht is back!?! |
|
I'll merge this unless somebody thinks otherwise, re-raising the exception instead of printing traceback seems like a minor enough problem not worth stalling over |
This makes
gen_exportsrun both linters on the generated files, improving the formatting a little.I ran
blackvia subprocess because its API doesn't provide a nice way to fetch configuration frompyproject.tomletc to maintain consistency, while also processing an in-memory string. Still doesn't remove the redundant parentheses, but oh well.