The following issues were found
Lib/test/test_asyncio/test_futures2.py
4 issues
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.
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.
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.
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
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 1
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Line: 2
Column: 1
from . import load_tests
import unittest
unittest.main()
Reported by Pylint.
Lib/test/badsyntax_future10.py
4 issues
Line: 2
Column: 1
from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function
Reported by Pylint.
Line: 3
Column: 1
from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function
Reported by Pylint.
Line: 1
Column: 1
from __future__ import absolute_import
"spam, bar, blah"
from __future__ import print_function
Reported by Pylint.
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
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.
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.
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.
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
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.
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.
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.
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
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.
Line: 7
Column: 1
# docstrings.
class Foo(object):
# A class with no docstring.
def __init__(self):
pass
Reported by Pylint.
Line: 7
Column: 1
# docstrings.
class Foo(object):
# A class with no docstring.
def __init__(self):
pass
Reported by Pylint.
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
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.
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.
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.
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
Line: 1
Column: 1
import multiprocessing
multiprocessing.Lock()
def f():
print("ok")
Reported by Pylint.
Line: 6
Column: 1
multiprocessing.Lock()
def f():
print("ok")
if __name__ == "__main__":
ctx = multiprocessing.get_context("forkserver")
Reported by Pylint.
Line: 6
Column: 1
multiprocessing.Lock()
def f():
print("ok")
if __name__ == "__main__":
ctx = multiprocessing.get_context("forkserver")
Reported by Pylint.
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
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.
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.
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.
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
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.
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.
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.
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.