Merge branch 'diable-multiprocessing-on-win' into 'master'

Diable multiprocessing behaviour on Windows

*Description of changes*

Due to https://bugs.python.org/issue27649, while Flake8 can *run* with multiprocessing on Windows, it does not behave as we expect it to behave. To provide the best experience that is in agreement with our documentation, we must disable multiprocessing until https://bugs.python.org/issue27649 is fixed and released.

Closes #184

See merge request !105
This commit is contained in:
Ian Cordasco 2016-07-29 12:16:45 +00:00
commit 20c619f649
4 changed files with 21 additions and 3 deletions

View file

@ -1,6 +1,9 @@
3.0.3 -- 2016-07-28 (unreleased)
--------------------------------
- Disable ``--jobs`` for any version of Python on Windows.
(See also `this Python bug report`_)
- Fix ``# noqa`` comments followed by a ``:`` and explanation broken by
3.0.0 (See also `GitLab#178`_)
@ -12,3 +15,6 @@
https://gitlab.com/pycqa/flake8/issues/178
.. _GitLab#195:
https://gitlab.com/pycqa/flake8/issues/195
.. _this Python bug report:
https://bugs.python.org/issue27649

View file

@ -167,7 +167,8 @@ class Manager(object):
if (utils.is_windows() and
not utils.can_run_multiprocessing_on_windows()):
LOG.warning('The --jobs option is only available on Windows on '
LOG.warning('The --jobs option is not available on Windows due to'
' a bug (https://bugs.python.org/issue27649) in '
'Python 2.7.11+ and 3.3+. We have detected that you '
'are running an unsupported version of Python on '
'Windows. Ignoring --jobs arguments.')

View file

@ -164,10 +164,20 @@ def is_windows():
return os.name == 'nt'
# NOTE(sigmavirus24): If and when https://bugs.python.org/issue27649 is fixed,
# re-enable multiprocessing support on Windows.
def can_run_multiprocessing_on_windows():
# type: () -> bool
"""Determine if we can use multiprocessing on Windows.
This presently will **always** return False due to a `bug`_ in the
:mod:`multiprocessing` module on Windows. Once fixed, we will check
to ensure that the version of Python contains that fix (via version
inspection) and *conditionally* re-enable support on Windows.
.. _bug:
https://bugs.python.org/issue27649
:returns:
True if the version of Python is modern enough, otherwise False
:rtype:
@ -175,7 +185,7 @@ def can_run_multiprocessing_on_windows():
"""
is_new_enough_python27 = (2, 7, 11) <= sys.version_info < (3, 0)
is_new_enough_python3 = sys.version_info > (3, 2)
return is_new_enough_python27 or is_new_enough_python3
return False and (is_new_enough_python27 or is_new_enough_python3)
def is_using_stdin(paths):

View file

@ -25,7 +25,8 @@ def test_oserrors_cause_serial_fall_back():
assert manager.using_multiprocessing is False
def test_oserrors_are_reraised():
@mock.patch('flake8.utils.is_windows', return_value=False)
def test_oserrors_are_reraised(is_windows):
"""Verify that OSErrors will cause the Manager to fallback to serial."""
err = OSError(errno.EAGAIN, 'Ominous message')
style_guide = style_guide_mock()