PyCQA / modernize

Modernizes Python code for eventual Python 3 migration. Built on top of fissix (a fork of lib2to3)
https://modernize.readthedocs.org/
Other
355 stars 51 forks source link

enforce does not return correct exit code when ran as multiple processes #250

Open MichalAugustyn opened 3 years ago

MichalAugustyn commented 3 years ago

It's very easy to reproduce with one line python file

# testfile.py 
test = range(5)

It's working with a single process

[10:21] () augustyn:tmp$ python -m modernize --enforce testfile.py 
...
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored testfile.py
--- testfile.py (original)
+++ testfile.py (refactored)
@@ -1 +1,2 @@
-test = range(5)
+from six.moves import range
+test = list(range(5))
RefactoringTool: Files that need to be modified:
RefactoringTool: testfile.py

[10:21] () augustyn:tmp$ echo $?
2

but not with multiple processes

[10:21] () augustyn:tmp$ python -m modernize --enforce testfile.py  -j 2
...
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored testfile.py
--- testfile.py (original)
+++ testfile.py (refactored)
@@ -1 +1,2 @@
-test = range(5)
+from six.moves import range
+test = list(range(5))
RefactoringTool: No files need to be modified.

[10:23] () augustyn:tmp$ echo $?
0