summaryrefslogtreecommitdiff
path: root/pylint/test/unittest_lint.py
diff options
context:
space:
mode:
authorRandall Leeds <randall@bleeds.info>2018-07-09 23:46:08 -0700
committerClaudiu Popa <pcmanticore@gmail.com>2018-07-10 08:46:08 +0200
commit7e999d609c53e82be51bb91ae0d2163c63b904a0 (patch)
treea21d87c509e674340bb689da812515eed2b0b32d /pylint/test/unittest_lint.py
parentaa0ef8582711ab60461b4379af6bcd817bcc59ca (diff)
downloadpylint-git-7e999d609c53e82be51bb91ae0d2163c63b904a0.tar.gz
Filter with should_analyze_file in parallel mode (#2264)
Each ChildLinter receives a file path and instantiates a linter to check that file. As such, all files are arguments to child linters in parallel mode. Therefore, the check for should_analyze_file must happen in the parent linter, where knowledge of the original arguments is available. Expand the custom should_analyze_file test to exercise parallel mode. Close #1885
Diffstat (limited to 'pylint/test/unittest_lint.py')
-rw-r--r--pylint/test/unittest_lint.py29
1 files changed, 16 insertions, 13 deletions
diff --git a/pylint/test/unittest_lint.py b/pylint/test/unittest_lint.py
index b8a153f86..6e8c54962 100644
--- a/pylint/test/unittest_lint.py
+++ b/pylint/test/unittest_lint.py
@@ -741,21 +741,24 @@ def test_custom_should_analyze_file():
package_dir = os.path.join(HERE, 'regrtest_data', 'bad_package')
wrong_file = os.path.join(package_dir, 'wrong.py')
- reporter = testutils.TestReporter()
- linter = CustomPyLinter()
- linter.config.persistent = 0
- linter.open()
- linter.set_reporter(reporter)
- try:
- sys.path.append(os.path.dirname(package_dir))
- linter.check([package_dir, wrong_file])
- finally:
- sys.path.pop()
+ for jobs in [1, 2]:
+ reporter = testutils.TestReporter()
+ linter = CustomPyLinter()
+ linter.config.jobs = jobs
+ linter.config.persistent = 0
+ linter.open()
+ linter.set_reporter(reporter)
- messages = reporter.messages
- assert len(messages) == 1
- assert 'invalid syntax' in messages[0]
+ try:
+ sys.path.append(os.path.dirname(package_dir))
+ linter.check([package_dir, wrong_file])
+ finally:
+ sys.path.pop()
+
+ messages = reporter.messages
+ assert len(messages) == 1
+ assert 'invalid syntax' in messages[0]
def test_filename_with__init__(init_linter):