mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
A few tweaks for issue16662 based on feedback from Robert Collins.
This commit is contained in:
parent
d78742a260
commit
bb1e3f1ebe
2 changed files with 46 additions and 38 deletions
|
@ -79,12 +79,15 @@ class TestLoader(object):
|
|||
# use_load_tests argument. For backward compatibility, we still
|
||||
# accept the argument (which can also be the first position) but we
|
||||
# ignore it and issue a deprecation warning if it's present.
|
||||
if len(args) == 1 or 'use_load_tests' in kws:
|
||||
if len(args) > 0 or 'use_load_tests' in kws:
|
||||
warnings.warn('use_load_tests is deprecated and ignored',
|
||||
DeprecationWarning)
|
||||
kws.pop('use_load_tests', None)
|
||||
if len(args) > 1:
|
||||
raise TypeError('loadTestsFromModule() takes 1 positional argument but {} were given'.format(len(args)))
|
||||
# Complain about the number of arguments, but don't forget the
|
||||
# required `module` argument.
|
||||
complaint = len(args) + 1
|
||||
raise TypeError('loadTestsFromModule() takes 1 positional argument but {} were given'.format(complaint))
|
||||
if len(kws) != 0:
|
||||
# Since the keyword arguments are unsorted (see PEP 468), just
|
||||
# pick the alphabetically sorted first argument to complain about,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue