The following issues were found

Lib/test/test_asyncio/test_futures2.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              # IsolatedAsyncioTestCase based tests
import asyncio
import unittest


class FutureTests(unittest.IsolatedAsyncioTestCase):
    async def test_recursive_repr_for_pending_tasks(self):
        # The call crashes if the guard for recursive call
        # in base_futures:_future_repr_info is absent

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 6 Column: 1

              import unittest


class FutureTests(unittest.IsolatedAsyncioTestCase):
    async def test_recursive_repr_for_pending_tasks(self):
        # The call crashes if the guard for recursive call
        # in base_futures:_future_repr_info is absent
        # See Also: https://bugs.python.org/issue42183


            

Reported by Pylint.

Missing class docstring
Error

Line: 6 Column: 1

              import unittest


class FutureTests(unittest.IsolatedAsyncioTestCase):
    async def test_recursive_repr_for_pending_tasks(self):
        # The call crashes if the guard for recursive call
        # in base_futures:_future_repr_info is absent
        # See Also: https://bugs.python.org/issue42183


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 5

              

class FutureTests(unittest.IsolatedAsyncioTestCase):
    async def test_recursive_repr_for_pending_tasks(self):
        # The call crashes if the guard for recursive call
        # in base_futures:_future_repr_info is absent
        # See Also: https://bugs.python.org/issue42183

        async def func():

            

Reported by Pylint.

Lib/test/test_asyncio/__main__.py
4 issues
Attempted relative import beyond top-level package
Error

Line: 1 Column: 1

              from . import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

Unused import load_tests
Error

Line: 1 Column: 1

              from . import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from . import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

standard import "import unittest" should be placed before "from . import load_tests"
Error

Line: 2 Column: 1

              from . import load_tests
import unittest

unittest.main()

            

Reported by Pylint.

Lib/test/badsyntax_future10.py
4 issues
String statement has no effect
Error

Line: 2 Column: 1

              from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function

            

Reported by Pylint.

__future__ import is not the first non docstring statement
Error

Line: 3 Column: 1

              from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function

            

Reported by Pylint.

Import "from __future__ import print_function" should be placed at the top of the module
Error

Line: 3 Column: 1

              from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function

            

Reported by Pylint.

Lib/test/support/logging_helper.py
4 issues
Parameters differ from overridden 'shouldFlush' method
Error

Line: 13 Column: 5

                      logging.handlers.BufferingHandler.__init__(self, 0)
        self.matcher = matcher

    def shouldFlush(self):
        return False

    def emit(self, record):
        self.format(record)
        self.buffer.append(record.__dict__)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import logging.handlers

class TestHandler(logging.handlers.BufferingHandler):
    def __init__(self, matcher):
        # BufferingHandler takes a "capacity" argument
        # so as to know when to flush. As we're overriding
        # shouldFlush anyway, we can set a capacity of zero.
        # You can call flush() manually to clear out the
        # buffer.

            

Reported by Pylint.

Missing class docstring
Error

Line: 3 Column: 1

              import logging.handlers

class TestHandler(logging.handlers.BufferingHandler):
    def __init__(self, matcher):
        # BufferingHandler takes a "capacity" argument
        # so as to know when to flush. As we're overriding
        # shouldFlush anyway, we can set a capacity of zero.
        # You can call flush() manually to clear out the
        # buffer.

            

Reported by Pylint.

Variable name "d" doesn't conform to snake_case naming style
Error

Line: 25 Column: 13

                      Look for a saved dict whose keys/values match the supplied arguments.
        """
        result = False
        for d in self.buffer:
            if self.matcher.matches(d, **kwargs):
                result = True
                break
        return result

            

Reported by Pylint.

Lib/test/ssltests.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              # Convenience test module to run all of the OpenSSL-related tests in the
# standard library.

import ssl
import sys
import subprocess

TESTS = [
    'test_asyncio', 'test_ensurepip.py', 'test_ftplib', 'test_hashlib',

            

Reported by Pylint.

Consider possible security implications associated with subprocess module.
Security blacklist

Line: 6
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_imports.html#b404-import-subprocess

              
import ssl
import sys
import subprocess

TESTS = [
    'test_asyncio', 'test_ensurepip.py', 'test_ftplib', 'test_hashlib',
    'test_hmac', 'test_httplib', 'test_imaplib', 'test_nntplib',
    'test_poplib', 'test_ssl', 'test_smtplib', 'test_smtpnet',

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 15 Column: 1

                  'test_urllib2_localnet', 'test_venv', 'test_xmlrpc'
]

def run_regrtests(*extra_args):
    print(ssl.OPENSSL_VERSION)
    args = [
        sys.executable,
        '-Werror', '-bb',  # turn warnings into exceptions
        '-m', 'test',

            

Reported by Pylint.

subprocess call - check for execution of untrusted input.
Security injection

Line: 33
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b603_subprocess_without_shell_equals_true.html

                  else:
        args.extend(extra_args)
    args.extend(TESTS)
    result = subprocess.call(args)
    sys.exit(result)

if __name__ == '__main__':
    run_regrtests(*sys.argv[1:])

            

Reported by Bandit.

Lib/test/sample_doctest_no_docstrings.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              # This is a sample module used for testing doctest.
#
# This module is for testing how doctest handles a module with no
# docstrings.


class Foo(object):

    # A class with no docstring.

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              # docstrings.


class Foo(object):

    # A class with no docstring.

    def __init__(self):
        pass

            

Reported by Pylint.

Class 'Foo' inherits from object, can be safely removed from bases in python3
Error

Line: 7 Column: 1

              # docstrings.


class Foo(object):

    # A class with no docstring.

    def __init__(self):
        pass

            

Reported by Pylint.

Too few public methods (0/2)
Error

Line: 7 Column: 1

              # docstrings.


class Foo(object):

    # A class with no docstring.

    def __init__(self):
        pass

            

Reported by Pylint.

Lib/test/regrtest.py
4 issues
Using variable '__file__' before assignment
Error

Line: 38 Column: 32

                  # absolute before changing the working directory.
    # For example __file__ may be relative when running trace or profile.
    # See issue #9323.
    __file__ = os.path.abspath(__file__)

    # sanity check
    assert __file__ == os.path.abspath(sys.argv[0])

    main()

            

Reported by Pylint.

Using the global statement
Error

Line: 19 Column: 5

              

def _main():
    global __file__

    # Remove regrtest.py's own directory from the module search path. Despite
    # the elimination of implicit relative imports, this is still needed to
    # ensure that submodules of the test package do not inappropriately appear
    # as top-level modules even when people (or buildbots!) invoke regrtest.py

            

Reported by Pylint.

Redefining built-in '__file__'
Error

Line: 19 Column: 5

              

def _main():
    global __file__

    # Remove regrtest.py's own directory from the module search path. Despite
    # the elimination of implicit relative imports, this is still needed to
    # ensure that submodules of the test package do not inappropriately appear
    # as top-level modules even when people (or buildbots!) invoke regrtest.py

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 41
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                  __file__ = os.path.abspath(__file__)

    # sanity check
    assert __file__ == os.path.abspath(sys.argv[0])

    main()


if __name__ == '__main__':

            

Reported by Bandit.

Lib/test/mp_preload.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              import multiprocessing

multiprocessing.Lock()


def f():
    print("ok")



            

Reported by Pylint.

Function name "f" doesn't conform to snake_case naming style
Error

Line: 6 Column: 1

              multiprocessing.Lock()


def f():
    print("ok")


if __name__ == "__main__":
    ctx = multiprocessing.get_context("forkserver")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              multiprocessing.Lock()


def f():
    print("ok")


if __name__ == "__main__":
    ctx = multiprocessing.get_context("forkserver")

            

Reported by Pylint.

Constant name "modname" doesn't conform to UPPER_CASE naming style
Error

Line: 12 Column: 5

              
if __name__ == "__main__":
    ctx = multiprocessing.get_context("forkserver")
    modname = "test.mp_preload"
    # Make sure it's importable
    __import__(modname)
    ctx.set_forkserver_preload([modname])
    proc = ctx.Process(target=f)
    proc.start()

            

Reported by Pylint.

Lib/test/mp_fork_bomb.py
4 issues
Missing module docstring
Error

Line: 1 Column: 1

              import multiprocessing, sys

def foo():
    print("123")

# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows.  However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.


            

Reported by Pylint.

Multiple imports on one line (multiprocessing, sys)
Error

Line: 1 Column: 1

              import multiprocessing, sys

def foo():
    print("123")

# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows.  However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.


            

Reported by Pylint.

Black listed name "foo"
Error

Line: 3 Column: 1

              import multiprocessing, sys

def foo():
    print("123")

# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows.  However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 3 Column: 1

              import multiprocessing, sys

def foo():
    print("123")

# Because "if __name__ == '__main__'" is missing this will not work
# correctly on Windows.  However, we should get a RuntimeError rather
# than the Windows equivalent of a fork bomb.


            

Reported by Pylint.

Lib/test/final_b.py
4 issues
Constant name "x" doesn't conform to UPPER_CASE naming style
Error

Line: 8 Column: 1

              import shutil
import test.final_a

x = 'b'

class C:
    def __del__(self):
        # Inspect module globals and builtins
        print("x =", x)

            

Reported by Pylint.

Class name "C" doesn't conform to PascalCase naming style
Error

Line: 10 Column: 1

              
x = 'b'

class C:
    def __del__(self):
        # Inspect module globals and builtins
        print("x =", x)
        print("final_a.x =", test.final_a.x)
        print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 10 Column: 1

              
x = 'b'

class C:
    def __del__(self):
        # Inspect module globals and builtins
        print("x =", x)
        print("final_a.x =", test.final_a.x)
        print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              
x = 'b'

class C:
    def __del__(self):
        # Inspect module globals and builtins
        print("x =", x)
        print("final_a.x =", test.final_a.x)
        print("shutil.rmtree =", getattr(shutil.rmtree, '__name__', None))

            

Reported by Pylint.