Skip to content

Commit 9fe6d86

Browse files
committed
Issue 19572: More silently skipped tests explicitly skipped.
1 parent 774f909 commit 9fe6d86

34 files changed

Lines changed: 126 additions & 138 deletions

Lib/test/datetimetester.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,7 @@ def newmeth(self, start):
20252025
class TestSubclassDateTime(TestDateTime):
20262026
theclass = SubclassDatetime
20272027
# Override tests not designed for subclass
2028+
@unittest.skip('not appropriate for subclasses')
20282029
def test_roundtrip(self):
20292030
pass
20302031

Lib/test/multibytecodec_support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def test_errorhandle(self):
7373

7474
def test_xmlcharrefreplace(self):
7575
if self.has_iso10646:
76-
return
76+
self.skipTest('encoding contains full ISO 10646 map')
7777

7878
s = "\u0b13\u0b23\u0b60 nd eggs"
7979
self.assertEqual(
@@ -83,7 +83,7 @@ def test_xmlcharrefreplace(self):
8383

8484
def test_customreplace_encode(self):
8585
if self.has_iso10646:
86-
return
86+
self.skipTest('encoding contains full ISO 10646 map')
8787

8888
from html.entities import codepoint2name
8989

Lib/test/string_tests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,10 @@ def test_replace(self):
663663
self.checkraises(TypeError, 'hello', 'replace', 42, 'h')
664664
self.checkraises(TypeError, 'hello', 'replace', 'h', 42)
665665

666+
@unittest.skipIf(sys.maxsize > (1 << 32) or struct.calcsize('P') != 4,
667+
'only applies to 32-bit platforms')
666668
def test_replace_overflow(self):
667669
# Check for overflow checking on 32 bit machines
668-
if sys.maxsize != 2147483647 or struct.calcsize("P") > 4:
669-
return
670670
A2_16 = "A" * (2**16)
671671
self.checkraises(OverflowError, A2_16, "replace", "", A2_16)
672672
self.checkraises(OverflowError, A2_16, "replace", "A", A2_16)

Lib/test/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ def test_coveritertraverse(self):
946946
try:
947947
import gc
948948
except ImportError:
949-
return
949+
self.skipTest('gc module not available')
950950
a = array.array(self.typecode)
951951
l = [iter(a)]
952952
l.append(l)

Lib/test/test_codecencodings_iso2022.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class Test_ISO2022_KR(multibytecodec_support.TestBase, unittest.TestCase):
3636

3737
# iso2022_kr.txt cannot be used to test "chunk coding": the escape
3838
# sequence is only written on the first line
39+
@unittest.skip('iso2022_kr.txt cannot be used to test "chunk coding"')
3940
def test_chunkcoding(self):
4041
pass
4142

Lib/test/test_configparser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,7 @@ class mystr(str):
707707

708708
def test_read_returns_file_list(self):
709709
if self.delimiters[0] != '=':
710-
# skip reading the file if we're using an incompatible format
711-
return
710+
self.skipTest('incompatible format')
712711
file1 = support.findfile("cfgparser.1")
713712
# check when we pass a mix of readable and non-readable files:
714713
cf = self.newconfig()

Lib/test/test_decimal.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,6 @@ def eval_file(self, file):
290290
global skip_expected
291291
if skip_expected:
292292
raise unittest.SkipTest
293-
return
294293
with open(file) as f:
295294
for line in f:
296295
line = line.replace('\r\n', '').replace('\n', '')
@@ -301,7 +300,6 @@ def eval_file(self, file):
301300
#Exception raised where there shouldn't have been one.
302301
self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line)
303302

304-
return
305303

306304
def eval_line(self, s):
307305
if s.find(' -> ') >= 0 and s[:2] != '--' and not s.startswith(' --'):
@@ -461,7 +459,6 @@ def FixQuotes(val):
461459

462460
self.assertEqual(myexceptions, theirexceptions,
463461
'Incorrect flags set in ' + s + ' -- got ' + str(myexceptions))
464-
return
465462

466463
def getexceptions(self):
467464
return [e for e in Signals[self.decimal] if self.context.flags[e]]
@@ -1073,7 +1070,7 @@ def test_n_format(self):
10731070
try:
10741071
from locale import CHAR_MAX
10751072
except ImportError:
1076-
return
1073+
self.skipTest('locale.CHAR_MAX not available')
10771074

10781075
def make_grouping(lst):
10791076
return ''.join([chr(x) for x in lst]) if self.decimal == C else lst
@@ -1164,8 +1161,12 @@ def test_wide_char_separator_decimal_point(self):
11641161

11651162
decimal_point = locale.localeconv()['decimal_point']
11661163
thousands_sep = locale.localeconv()['thousands_sep']
1167-
if decimal_point != '\u066b' or thousands_sep != '\u066c':
1168-
return
1164+
if decimal_point != '\u066b':
1165+
self.skipTest('inappropriate decimal point separator'
1166+
'({!r} not {!r})'.format(decimal_point, '\u066b'))
1167+
if thousands_sep != '\u066c':
1168+
self.skipTest('inappropriate thousands separator'
1169+
'({!r} not {!r})'.format(thousands_sep, '\u066c'))
11691170

11701171
self.assertEqual(format(Decimal('100000000.123'), 'n'),
11711172
'100\u066c000\u066c000\u066b123')
@@ -1515,7 +1516,6 @@ def thfunc1(cls):
15151516
cls.assertTrue(c1.flags[Inexact])
15161517
for sig in Overflow, Underflow, DivisionByZero, InvalidOperation:
15171518
cls.assertFalse(c1.flags[sig])
1518-
return
15191519

15201520
def thfunc2(cls):
15211521
Decimal = cls.decimal.Decimal
@@ -1560,7 +1560,6 @@ def thfunc2(cls):
15601560
cls.assertTrue(thiscontext.flags[Inexact])
15611561
for sig in Overflow, Underflow, DivisionByZero, InvalidOperation:
15621562
cls.assertFalse(thiscontext.flags[sig])
1563-
return
15641563

15651564
class ThreadingTest(unittest.TestCase):
15661565
'''Unit tests for thread local contexts in Decimal.'''
@@ -1602,7 +1601,6 @@ def test_threading(self):
16021601
DefaultContext.prec = save_prec
16031602
DefaultContext.Emax = save_emax
16041603
DefaultContext.Emin = save_emin
1605-
return
16061604

16071605
@unittest.skipUnless(threading, 'threading required')
16081606
class CThreadingTest(ThreadingTest):
@@ -4525,7 +4523,6 @@ def checkSameDec(operation, useOther=False):
45254523
self.assertEqual(d1._sign, b1._sign)
45264524
self.assertEqual(d1._int, b1._int)
45274525
self.assertEqual(d1._exp, b1._exp)
4528-
return
45294526

45304527
Decimal(d1)
45314528
self.assertEqual(d1._sign, b1._sign)
@@ -5271,7 +5268,7 @@ def test_invalid_override(self):
52715268
try:
52725269
from locale import CHAR_MAX
52735270
except ImportError:
5274-
return
5271+
self.skipTest('locale.CHAR_MAX not available')
52755272

52765273
def make_grouping(lst):
52775274
return ''.join([chr(x) for x in lst])

Lib/test/test_dis.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,16 +217,18 @@ def test_dis(self):
217217
def test_bug_708901(self):
218218
self.do_disassembly_test(bug708901, dis_bug708901)
219219

220+
# Test has been disabled due to change in the way
221+
# list comps are handled. The byte code now includes
222+
# a memory address and a file location, so they change from
223+
# run to run.
224+
@unittest.skip('disabled due to a change in the way list comps are handled')
220225
def test_bug_1333982(self):
221226
# XXX: re-enable this test!
222227
# This one is checking bytecodes generated for an `assert` statement,
223228
# so fails if the tests are run with -O. Skip this test then.
224-
pass # Test has been disabled due to change in the way
225-
# list comps are handled. The byte code now includes
226-
# a memory address and a file location, so they change from
227-
# run to run.
228-
# if __debug__:
229-
# self.do_disassembly_test(bug1333982, dis_bug1333982)
229+
230+
if __debug__:
231+
self.do_disassembly_test(bug1333982, dis_bug1333982)
230232

231233
def test_big_linenos(self):
232234
def func(count):

Lib/test/test_fileio.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ def testBytesOpen(self):
341341
try:
342342
fn = TESTFN.encode("ascii")
343343
except UnicodeEncodeError:
344-
# Skip test
345-
return
344+
self.skipTest('could not encode %r to ascii' % TESTFN)
346345
f = _FileIO(fn, "w")
347346
try:
348347
f.write(b"abc")

Lib/test/test_float.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def test_float_with_comma(self):
7070
# it still has to accept the normal python syntax
7171
import locale
7272
if not locale.localeconv()['decimal_point'] == ',':
73-
return
73+
self.skipTest('decimal_point is not ","')
7474

7575
self.assertEqual(float(" 3.14 "), 3.14)
7676
self.assertEqual(float("+3.14 "), 3.14)

0 commit comments

Comments
 (0)