The following issues were found
Lib/typing.py
8 issues
Line: 699
Suggestion:
https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval
sys.modules.get(self.__forward_module__, None), '__dict__', globalns
)
type_ =_type_check(
eval(self.__forward_code__, globalns, localns),
"Forward references must evaluate to types.",
is_argument=self.__forward_is_argument__,
)
self.__forward_value__ = _eval_type(
type_, globalns, localns, recursive_guard | {self.__forward_arg__}
Reported by Bandit.
Line: 246
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# Special case where Z[[int, str, bool]] == Z[int, str, bool] in PEP 612.
if (len(cls.__parameters__) == 1
and params and not _is_param_expr(params[0])):
assert isinstance(cls.__parameters__[0], ParamSpec)
return (params,)
else:
_check_generic(cls, params, len(cls.__parameters__))
_params = []
# Convert lists to tuples to help other libraries cache the results.
Reported by Bandit.
Line: 268
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
new_params.append(t)
all_params.remove(t)
params = new_params
assert not all_params, all_params
return params
def _remove_dups_flatten(parameters):
"""An internal helper for Union creation and substitution: flatten Unions
Reported by Bandit.
Line: 1153
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
class _CallableGenericAlias(_GenericAlias, _root=True):
def __repr__(self):
assert self._name == 'Callable'
args = self.__args__
if len(args) == 2 and _is_param_expr(args[0]):
return super().__repr__()
return (f'typing.Callable'
f'[[{", ".join([_type_repr(a) for a in args[:-1]])}], '
Reported by Bandit.
Line: 1585
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
self.__metadata__ = metadata
def copy_with(self, params):
assert len(params) == 1
new_type = params[0]
return _AnnotatedAlias(new_type, self.__metadata__)
def __repr__(self):
return "typing.Annotated[{}, {}]".format(
Reported by Bandit.
Line: 1714
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
res = dict(kwdefaults) if kwdefaults else {}
pos_offset = pos_count - len(defaults)
for name, value in zip(arg_names[pos_offset:], defaults):
assert name not in res
res[name] = value
return res
_allowed_types = (types.FunctionType, types.BuiltinFunctionType,
Reported by Bandit.
Line: 2213
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
class NamedTupleMeta(type):
def __new__(cls, typename, bases, ns):
assert bases[0] is _NamedTuple
types = ns.get('__annotations__', {})
default_names = []
for field_name in types:
if field_name in ns:
default_names.append(field_name)
Reported by Bandit.
Line: 2272
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def _namedtuple_mro_entries(bases):
if len(bases) > 1:
raise TypeError("Multiple inheritance with NamedTuple is not supported")
assert bases[0] is NamedTuple
return (_NamedTuple,)
NamedTuple.__mro_entries__ = _namedtuple_mro_entries
Reported by Bandit.
Tools/c-analyzer/c_common/clsutil.py
8 issues
Line: 56
Column: 3
self.instances[id(obj)] = value
if value is _NOT_SET:
raise AttributeError(self.name)
# XXX Optionally make a copy?
return value
def __set__(self, obj, value):
if self.readonly:
raise AttributeError(f'{self.name} is readonly')
Reported by Pylint.
Line: 62
Column: 3
def __set__(self, obj, value):
if self.readonly:
raise AttributeError(f'{self.name} is readonly')
# XXX Optionally coerce?
self.instances[id(obj)] = value
def __delete__(self, obj):
if self.readonly:
raise AttributeError(f'{self.name} is readonly')
Reported by Pylint.
Line: 68
Column: 3
def __delete__(self, obj):
if self.readonly:
raise AttributeError(f'{self.name} is readonly')
self.instances[id(obj)] = self.default # XXX refleak?
def _ensure___del__(self, cls, slotnames): # See the comment in __init__().
try:
old___del__ = cls.__del__
except AttributeError:
Reported by Pylint.
Line: 83
Column: 9
for name in slotnames:
delattr(_self, name)
old___del__(_self)
__del__._slotted = True
cls.__del__ = __del__
def set(self, obj, value):
"""Update the cached value for an object.
Reported by Pylint.
Line: 1
Column: 1
_NOT_SET = object()
class Slot:
"""A descriptor that provides a slot.
This is useful for types that can't have slots via __slots__,
e.g. tuple subclasses.
Reported by Pylint.
Line: 70
Column: 5
raise AttributeError(f'{self.name} is readonly')
self.instances[id(obj)] = self.default # XXX refleak?
def _ensure___del__(self, cls, slotnames): # See the comment in __init__().
try:
old___del__ = cls.__del__
except AttributeError:
old___del__ = (lambda s: None)
else:
Reported by Pylint.
Line: 96
Column: 1
self.instances[id(obj)] = value
class classonly:
"""A non-data descriptor that makes a value only visible on the class.
This is like the "classmethod" builtin, but does not show up on
instances of the class. It may be used as a decorator.
"""
Reported by Pylint.
Line: 96
Column: 1
self.instances[id(obj)] = value
class classonly:
"""A non-data descriptor that makes a value only visible on the class.
This is like the "classmethod" builtin, but does not show up on
instances of the class. It may be used as a decorator.
"""
Reported by Pylint.
Lib/test/test_tools/test_reindent.py
8 issues
Line: 23
Column: 9
assert_python_ok(self.script)
def test_help(self):
rc, out, err = assert_python_ok(self.script, '-h')
self.assertEqual(out, b'')
self.assertGreater(err, b'')
def test_reindent_file_with_bad_encoding(self):
bad_coding_path = findfile('bad_coding.py')
Reported by Pylint.
Line: 29
Column: 9
def test_reindent_file_with_bad_encoding(self):
bad_coding_path = findfile('bad_coding.py')
rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path)
self.assertEqual(out, b'')
self.assertNotEqual(err, b'')
if __name__ == '__main__':
Reported by Pylint.
Line: 16
Column: 1
skip_if_missing()
class ReindentTests(unittest.TestCase):
script = os.path.join(scriptsdir, 'reindent.py')
def test_noargs(self):
assert_python_ok(self.script)
Reported by Pylint.
Line: 19
Column: 5
class ReindentTests(unittest.TestCase):
script = os.path.join(scriptsdir, 'reindent.py')
def test_noargs(self):
assert_python_ok(self.script)
def test_help(self):
rc, out, err = assert_python_ok(self.script, '-h')
self.assertEqual(out, b'')
Reported by Pylint.
Line: 22
Column: 5
def test_noargs(self):
assert_python_ok(self.script)
def test_help(self):
rc, out, err = assert_python_ok(self.script, '-h')
self.assertEqual(out, b'')
self.assertGreater(err, b'')
def test_reindent_file_with_bad_encoding(self):
Reported by Pylint.
Line: 23
Column: 9
assert_python_ok(self.script)
def test_help(self):
rc, out, err = assert_python_ok(self.script, '-h')
self.assertEqual(out, b'')
self.assertGreater(err, b'')
def test_reindent_file_with_bad_encoding(self):
bad_coding_path = findfile('bad_coding.py')
Reported by Pylint.
Line: 27
Column: 5
self.assertEqual(out, b'')
self.assertGreater(err, b'')
def test_reindent_file_with_bad_encoding(self):
bad_coding_path = findfile('bad_coding.py')
rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path)
self.assertEqual(out, b'')
self.assertNotEqual(err, b'')
Reported by Pylint.
Line: 29
Column: 9
def test_reindent_file_with_bad_encoding(self):
bad_coding_path = findfile('bad_coding.py')
rc, out, err = assert_python_ok(self.script, '-r', bad_coding_path)
self.assertEqual(out, b'')
self.assertNotEqual(err, b'')
if __name__ == '__main__':
Reported by Pylint.
Lib/test/test_tools/test_fixcid.py
8 issues
Line: 68
Column: 9
file.write("int xx;\n")
with open(os.path.join(os_helper.TESTFN, "file.py"), "w") as file:
file.write("xx = 'unaltered'\n")
script = os.path.join(scriptsdir, "fixcid.py")
output = self.run_script(args=(os_helper.TESTFN,))
self.assertMultiLineEqual(output,
"{}:\n"
"1\n"
'< int xx;\n'
Reported by Pylint.
Line: 77
Column: 26
'> int yy;\n'.format(c_filename)
)
def run_script(self, input="", *, args=("-",), substfile="xx yy\n"):
substfilename = os_helper.TESTFN + ".subst"
with open(substfilename, "w") as file:
file.write(substfile)
self.addCleanup(os_helper.unlink, substfilename)
Reported by Pylint.
Line: 4
Column: 1
'''Test Tools/scripts/fixcid.py.'''
from io import StringIO
import os, os.path
import runpy
import sys
from test import support
from test.support import os_helper
from test.test_tools import skip_if_missing, scriptsdir
Reported by Pylint.
Line: 14
Column: 1
skip_if_missing()
class Test(unittest.TestCase):
def test_parse_strings(self):
old1 = 'int xx = "xx\\"xx"[xx];\n'
old2 = "int xx = 'x\\'xx' + xx;\n"
output = self.run_script(old1 + old2)
new1 = 'int yy = "xx\\"xx"[yy];\n'
Reported by Pylint.
Line: 15
Column: 5
skip_if_missing()
class Test(unittest.TestCase):
def test_parse_strings(self):
old1 = 'int xx = "xx\\"xx"[xx];\n'
old2 = "int xx = 'x\\'xx' + xx;\n"
output = self.run_script(old1 + old2)
new1 = 'int yy = "xx\\"xx"[yy];\n'
new2 = "int yy = 'x\\'xx' + yy;\n"
Reported by Pylint.
Line: 32
Column: 5
"{new2}".format(old1=old1, old2=old2, new1=new1, new2=new2)
)
def test_alter_comments(self):
output = self.run_script(
substfile=
"xx yy\n"
"*aa bb\n",
args=("-c", "-",),
Reported by Pylint.
Line: 60
Column: 5
"int bb;\n"
)
def test_directory(self):
os.mkdir(os_helper.TESTFN)
self.addCleanup(os_helper.rmtree, os_helper.TESTFN)
c_filename = os.path.join(os_helper.TESTFN, "file.c")
with open(c_filename, "w") as file:
file.write("int xx;\n")
Reported by Pylint.
Line: 77
Column: 5
'> int yy;\n'.format(c_filename)
)
def run_script(self, input="", *, args=("-",), substfile="xx yy\n"):
substfilename = os_helper.TESTFN + ".subst"
with open(substfilename, "w") as file:
file.write(substfile)
self.addCleanup(os_helper.unlink, substfilename)
Reported by Pylint.
Tools/demo/vector.py
8 issues
Line: 42
Column: 9
"""
def __init__(self, *v):
self.v = list(v)
@classmethod
def fromlist(cls, v):
if not isinstance(v, list):
raise TypeError
Reported by Pylint.
Line: 45
Column: 5
self.v = list(v)
@classmethod
def fromlist(cls, v):
if not isinstance(v, list):
raise TypeError
inst = cls()
inst.v = v
return inst
Reported by Pylint.
Line: 45
Column: 5
self.v = list(v)
@classmethod
def fromlist(cls, v):
if not isinstance(v, list):
raise TypeError
inst = cls()
inst.v = v
return inst
Reported by Pylint.
Line: 68
Column: 9
def __add__(self, other):
"Element-wise addition"
v = [x + y for x, y in zip(self.v, other.v)]
return Vec.fromlist(v)
def __sub__(self, other):
"Element-wise subtraction"
v = [x - y for x, y in zip(self.v, other.v)]
Reported by Pylint.
Line: 73
Column: 9
def __sub__(self, other):
"Element-wise subtraction"
v = [x - y for x, y in zip(self.v, other.v)]
return Vec.fromlist(v)
def __mul__(self, scalar):
"Multiply by scalar"
v = [x * scalar for x in self.v]
Reported by Pylint.
Line: 78
Column: 9
def __mul__(self, scalar):
"Multiply by scalar"
v = [x * scalar for x in self.v]
return Vec.fromlist(v)
__rmul__ = __mul__
def dot(self, other):
Reported by Pylint.
Line: 90
Column: 1
return sum(x_i * y_i for (x_i, y_i) in zip(self, other))
def test():
import doctest
doctest.testmod()
test()
Reported by Pylint.
Line: 91
Column: 5
def test():
import doctest
doctest.testmod()
test()
Reported by Pylint.
Modules/_ctypes/libffi_osx/x86/x86-ffi64.c
8 issues
Line: 492
Column: 4
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* Pass this argument in memory. */
argp = (void *) ALIGN (argp, align);
memcpy (argp, avalue[i], size);
argp += size;
}
else
{ /* The argument is passed entirely in registers. */
char *a = (char *) avalue[i];
Reported by FlawFinder.
Line: 497
Column: 15
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
}
else
{ /* The argument is passed entirely in registers. */
char *a = (char *) avalue[i];
int j;
for (j = 0; j < n; j++, a += 8, size -= 8)
{
switch (classes[j])
Reported by FlawFinder.
Line: 521
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
{
int16_t shortval = *(int16_t*)a;
int64_t actval = (int64_t)shortval;
memcpy (®_args->gpr[gprcount], &actval, 8);
break;
}
case FFI_TYPE_SINT32:
{
Reported by FlawFinder.
Line: 529
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
{
int32_t shortval = *(int32_t*)a;
int64_t actval = (int64_t)shortval;
memcpy (®_args->gpr[gprcount], &actval, 8);
break;
}
case FFI_TYPE_UINT8:
{
Reported by FlawFinder.
Line: 546
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
{
u_int16_t shortval = *(u_int16_t*)a;
u_int64_t actval = (u_int64_t)shortval;
memcpy (®_args->gpr[gprcount], &actval, 8);
break;
}
case FFI_TYPE_UINT32:
{
Reported by FlawFinder.
Line: 554
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
{
u_int32_t shortval = *(u_int32_t*)a;
u_int64_t actval = (u_int64_t)shortval;
memcpy (®_args->gpr[gprcount], &actval, 8);
break;
}
default:
//memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8);
Reported by FlawFinder.
Line: 723
Column: 6
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
for (j = 0; j < n; j++, a += 8)
{
if (SSE_CLASS_P (classes[j]))
memcpy (a, ®_args->sse[ssecount++], 8);
else
memcpy (a, ®_args->gpr[gprcount++], 8);
}
}
}
Reported by FlawFinder.
Line: 725
Column: 6
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
if (SSE_CLASS_P (classes[j]))
memcpy (a, ®_args->sse[ssecount++], 8);
else
memcpy (a, ®_args->gpr[gprcount++], 8);
}
}
}
/* Invoke the closure. */
Reported by FlawFinder.
Lib/test/test_tabnanny.py
8 issues
Line: 7
Column: 1
* errored : Whitespace related problems present in file.
"""
from unittest import TestCase, mock
from unittest import mock
import errno
import os
import tabnanny
import tokenize
import tempfile
Reported by Pylint.
Line: 76
Column: 9
mode='w', dir=self.dir, suffix=".py", delete=False
) as f:
f.write(self.source_code)
self.file_path = f.name
return self.file_path
def __exit__(self, exc_type, exc_value, exc_traceback):
unlink(self.file_path)
Reported by Pylint.
Line: 251
Column: 53
code_file = TemporaryPyFile(
SOURCE_CODES["error_free"], directory=tmp_dir
)
with error_file as e_file, code_file as c_file:
err = ('unindent does not match any outer indentation level'
' (<tokenize>, line 3)\n')
err = f"{e_file!r}: Indentation Error: {err}"
self.verify_tabnanny_check(tmp_dir, err=err)
Reported by Pylint.
Line: 74
Column: 14
def __enter__(self):
with tempfile.NamedTemporaryFile(
mode='w', dir=self.dir, suffix=".py", delete=False
) as f:
f.write(self.source_code)
self.file_path = f.name
return self.file_path
def __exit__(self, exc_type, exc_value, exc_traceback):
Reported by Pylint.
Line: 119
Column: 1
self.assertEqual(stderr.getvalue() , expected)
class TestNannyNag(TestCase):
def test_all_methods(self):
"""Asserting behaviour of `tabnanny.NannyNag` exception."""
tests = [
(
tabnanny.NannyNag(0, "foo", "bar"),
Reported by Pylint.
Line: 262
Column: 5
"""Testing `tabnanny.process_tokens()`."""
@mock.patch('tabnanny.NannyNag')
def test_with_correct_code(self, MockNannyNag):
"""A python source code without any whitespace related problems."""
with TemporaryPyFile(SOURCE_CODES["error_free"]) as file_path:
with open(file_path) as f:
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
Reported by Pylint.
Line: 266
Column: 37
"""A python source code without any whitespace related problems."""
with TemporaryPyFile(SOURCE_CODES["error_free"]) as file_path:
with open(file_path) as f:
tabnanny.process_tokens(tokenize.generate_tokens(f.readline))
self.assertFalse(MockNannyNag.called)
def test_with_errored_codes_samples(self):
"""A python source code with whitespace related sampled problems."""
Reported by Pylint.
Line: 282
Column: 45
for key in ["tab_space_errored_1", "tab_space_errored_2"]:
with self.subTest(key=key):
with TemporaryPyFile(SOURCE_CODES[key]) as file_path:
with open(file_path) as f:
tokens = tokenize.generate_tokens(f.readline)
with self.assertRaises(tabnanny.NannyNag):
tabnanny.process_tokens(tokens)
Reported by Pylint.
Tools/c-analyzer/c_parser/__init__.py
8 issues
Line: 1
Column: 1
from .parser import parse as _parse
from .preprocessor import get_preprocessor as _get_preprocessor
def parse_file(filename, *,
match_kind=None,
get_file_preprocessor=None,
):
if get_file_preprocessor is None:
Reported by Pylint.
Line: 2
Column: 1
from .parser import parse as _parse
from .preprocessor import get_preprocessor as _get_preprocessor
def parse_file(filename, *,
match_kind=None,
get_file_preprocessor=None,
):
if get_file_preprocessor is None:
Reported by Pylint.
Line: 46
Column: 1
# aliases
from .info import resolve_parsed
Reported by Pylint.
Line: 1
Column: 1
from .parser import parse as _parse
from .preprocessor import get_preprocessor as _get_preprocessor
def parse_file(filename, *,
match_kind=None,
get_file_preprocessor=None,
):
if get_file_preprocessor is None:
Reported by Pylint.
Line: 5
Column: 1
from .preprocessor import get_preprocessor as _get_preprocessor
def parse_file(filename, *,
match_kind=None,
get_file_preprocessor=None,
):
if get_file_preprocessor is None:
get_file_preprocessor = _get_preprocessor()
Reported by Pylint.
Line: 14
Column: 1
yield from _parse_file(filename, match_kind, get_file_preprocessor)
def parse_files(filenames, *,
match_kind=None,
get_file_preprocessor=None,
):
if get_file_preprocessor is None:
get_file_preprocessor = _get_preprocessor()
Reported by Pylint.
Line: 41
Column: 1
yield item
def parse_signature(text):
raise NotImplementedError
# aliases
from .info import resolve_parsed
Reported by Pylint.
Line: 46
Column: 1
# aliases
from .info import resolve_parsed
Reported by Pylint.
Modules/pyexpat.c
8 issues
Line: 332
Column: 13
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
self->buffer_used = 0;
}
else {
memcpy(self->buffer + self->buffer_used,
data, len * sizeof(XML_Char));
self->buffer_used += len;
}
}
}
Reported by FlawFinder.
Line: 798
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
buf_size, len);
goto error;
}
memcpy(buf, ptr, len);
Py_DECREF(str);
/* len <= buf_size <= INT_MAX */
return (int)len;
error:
Reported by FlawFinder.
Line: 1085
Column: 21
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
const XML_Char *name,
XML_Encoding *info)
{
static unsigned char template_buffer[256] = {0};
PyObject* u;
int i;
const void *data;
unsigned int kind;
Reported by FlawFinder.
Line: 1367
Column: 9
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
/* check maximum */
if (new_buffer_size > INT_MAX) {
char errmsg[100];
sprintf(errmsg, "buffer_size must not be greater than %i", INT_MAX);
PyErr_SetString(PyExc_ValueError, errmsg);
return -1;
}
Reported by FlawFinder.
Line: 1368
Column: 9
CWE codes:
120
Suggestion:
Use sprintf_s, snprintf, or vsnprintf
/* check maximum */
if (new_buffer_size > INT_MAX) {
char errmsg[100];
sprintf(errmsg, "buffer_size must not be greater than %i", INT_MAX);
PyErr_SetString(PyExc_ValueError, errmsg);
return -1;
}
if (self->buffer != NULL) {
Reported by FlawFinder.
Line: 162
Column: 38
CWE codes:
126
if (str == NULL) {
Py_RETURN_NONE;
}
return PyUnicode_DecodeUTF8(str, strlen(str), "strict");
}
static PyObject *
conv_string_len_to_unicode(const XML_Char *str, int len)
{
Reported by FlawFinder.
Line: 825
Column: 20
CWE codes:
120
20
{
int rv = 1;
PyObject *readmethod = NULL;
_Py_IDENTIFIER(read);
pyexpat_state *state = PyType_GetModuleState(cls);
if (_PyObject_LookupAttrId(file, &PyId_read, &readmethod) < 0) {
return NULL;
Reported by FlawFinder.
Line: 1533
Column: 12
CWE codes:
126
int intern_decref = 0;
if (namespace_separator != NULL
&& strlen(namespace_separator) > 1) {
PyErr_SetString(PyExc_ValueError,
"namespace_separator must be at most one"
" character, omitted, or None");
return NULL;
}
Reported by FlawFinder.
Lib/test/test_startfile.py
8 issues
Line: 1
Column: 1
# Ridiculously simple test of the os.startfile function for Windows.
#
# empty.vbs is an empty file (except for a comment), which does
# nothing when run with cscript or wscript.
#
# A possible improvement would be to have empty.vbs do something that
# we can detect here, to make sure that not only the os.startfile()
# call succeeded, but also the script actually has run.
Reported by Pylint.
Line: 21
Column: 1
startfile = support.get_attribute(os, 'startfile')
@unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver")
class TestCase(unittest.TestCase):
def test_nonexisting(self):
self.assertRaises(OSError, startfile, "nonexisting.vbs")
def test_empty(self):
Reported by Pylint.
Line: 22
Column: 1
@unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver")
class TestCase(unittest.TestCase):
def test_nonexisting(self):
self.assertRaises(OSError, startfile, "nonexisting.vbs")
def test_empty(self):
# We need to make sure the child process starts in a directory
Reported by Pylint.
Line: 23
Column: 5
@unittest.skipIf(platform.win32_is_iot(), "starting files is not supported on Windows IoT Core or nanoserver")
class TestCase(unittest.TestCase):
def test_nonexisting(self):
self.assertRaises(OSError, startfile, "nonexisting.vbs")
def test_empty(self):
# We need to make sure the child process starts in a directory
# we're not about to delete. If we're running under -j, that
Reported by Pylint.
Line: 26
Column: 5
def test_nonexisting(self):
self.assertRaises(OSError, startfile, "nonexisting.vbs")
def test_empty(self):
# We need to make sure the child process starts in a directory
# we're not about to delete. If we're running under -j, that
# means the test harness provided directory isn't a safe option.
# See http://bugs.python.org/issue15526 for more details
with os_helper.change_cwd(path.dirname(sys.executable)):
Reported by Pylint.
Line: 26
Column: 5
def test_nonexisting(self):
self.assertRaises(OSError, startfile, "nonexisting.vbs")
def test_empty(self):
# We need to make sure the child process starts in a directory
# we're not about to delete. If we're running under -j, that
# means the test harness provided directory isn't a safe option.
# See http://bugs.python.org/issue15526 for more details
with os_helper.change_cwd(path.dirname(sys.executable)):
Reported by Pylint.
Line: 37
Column: 5
startfile(empty, "open")
startfile(empty, cwd=path.dirname(sys.executable))
def test_python(self):
# Passing "-V" ensures that it closes quickly, though still not
# quickly enough that we can run in the test directory
cwd, name = path.split(sys.executable)
startfile(name, arguments="-V", cwd=cwd)
startfile(name, arguments="-V", cwd=cwd, show_cmd=0)
Reported by Pylint.
Line: 37
Column: 5
startfile(empty, "open")
startfile(empty, cwd=path.dirname(sys.executable))
def test_python(self):
# Passing "-V" ensures that it closes quickly, though still not
# quickly enough that we can run in the test directory
cwd, name = path.split(sys.executable)
startfile(name, arguments="-V", cwd=cwd)
startfile(name, arguments="-V", cwd=cwd, show_cmd=0)
Reported by Pylint.