summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormanderj <joffrey.mander+pro@gmail.com>2020-10-02 01:41:06 +0200
committermanderj <joffrey.mander+pro@gmail.com>2020-10-30 22:13:16 +0100
commit136ab0f960527ffe7cbc7e76f3a94ee81f434b02 (patch)
treed8a786ea6f784e58fd7a30af0bb6c9ff33fc1615
parent34d6fcbd19a8fb3399c5a9ff6ea43fc5de327cac (diff)
downloadpylint-git-136ab0f960527ffe7cbc7e76f3a94ee81f434b02.tar.gz
lint multiprocessing pool shutdown
-rw-r--r--CONTRIBUTORS.txt2
-rw-r--r--ChangeLog6
-rw-r--r--doc/whatsnew/2.6.rst2
-rw-r--r--pylint/lint/parallel.py18
4 files changed, 20 insertions, 8 deletions
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 3ef1862bc..702af289a 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -425,3 +425,5 @@ contributors:
* Giuseppe Valente: contributor
* Takashi Hirashima: contributor
+
+* Joffrey Mander: contributor
diff --git a/ChangeLog b/ChangeLog
index 377817b3d..fff8ec92f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,10 @@ What's New in Pylint 2.6.1?
===========================
Release date: TBA
+* Fix linter multiprocessing pool shutdown (triggered warnings when runned in parallels with other pytest plugins)
+
+ Closes #3779
+
* Fix a false-positive emission of `no-self-use` and `unused-argument` for methods
of generic structural types (`Protocol[T]`)
@@ -23,7 +27,7 @@ Release date: TBA
* Fix bug that lead to duplicate messages when using ``--jobs 2`` or more.
Close #3584
-
+
* Adds option ``check-protected-access-in-special-methods`` in the ClassChecker to activate/deactivate
``protected-access`` message emission for single underscore prefixed attribute in special methods.
diff --git a/doc/whatsnew/2.6.rst b/doc/whatsnew/2.6.rst
index 622ed5ea3..1002d1aad 100644
--- a/doc/whatsnew/2.6.rst
+++ b/doc/whatsnew/2.6.rst
@@ -29,6 +29,8 @@ New checkers
Other Changes
=============
+* Fix linter multiprocessing pool shutdown which triggered warnings when runned in parallels with other pytest plugins.
+
* Enums are now required to be named in UPPER_CASE by ``invalid-name``.
* Fix bug that lead to duplicate messages when using ``--jobs 2`` or more.
diff --git a/pylint/lint/parallel.py b/pylint/lint/parallel.py
index b9257191c..fa1e65d8f 100644
--- a/pylint/lint/parallel.py
+++ b/pylint/lint/parallel.py
@@ -91,15 +91,16 @@ def check_parallel(linter, jobs, files, arguments=None):
# is identical to the linter object here. This is requred so that
# a custom PyLinter object can be used.
initializer = functools.partial(_worker_initialize, arguments=arguments)
- with multiprocessing.Pool(jobs, initializer=initializer, initargs=[linter]) as pool:
- # ..and now when the workers have inherited the linter, the actual reporter
- # can be set back here on the parent process so that results get stored into
- # correct reporter
- linter.set_reporter(original_reporter)
- linter.open()
+ pool = multiprocessing.Pool(jobs, initializer=initializer, initargs=[linter])
+ # ..and now when the workers have inherited the linter, the actual reporter
+ # can be set back here on the parent process so that results get stored into
+ # correct reporter
+ linter.set_reporter(original_reporter)
+ linter.open()
- all_stats = []
+ all_stats = []
+ try:
for (
module,
file_path,
@@ -116,6 +117,9 @@ def check_parallel(linter, jobs, files, arguments=None):
all_stats.append(stats)
linter.msg_status |= msg_status
+ finally:
+ pool.close()
+ pool.join()
linter.stats = _merge_stats(all_stats)