Skip to content

Commit 645e503

Browse files
authored
bpo-30822: Exclude tzdata from regrtest --all (#2775) (#2781)
When running the test suite using --use=all / -u all, exclude tzdata since it makes test_datetime too slow (15-20 min on some buildbots) which then times out on some buildbots. -u tzdata must now be enabled explicitly, -u tzdata or -u all,tzdata, to run all test_datetime tests. Fix also regrtest command line parser to allow passing -u extralargefile to run test_zipfile64. Travis CI: remove -tzdata. Replace -u all,-tzdata,-cpu with -u all,-cpu since tzdata is now excluded from -u all. (cherry picked from commit 5b392bb)
1 parent 71d9b52 commit 645e503

File tree

4 files changed

+34
-4
lines changed

4 files changed

+34
-4
lines changed

Lib/test/libregrtest/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# We import importlib *ASAP* in order to test #15386
2+
import importlib
3+
4+
from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES, ALL_RESOURCES
5+
from test.libregrtest.main import main

Lib/test/regrtest.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,17 @@
207207

208208
from test import support
209209

210-
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
211-
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
210+
ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network',
211+
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
212+
213+
# Other resources excluded from --use=all:
214+
#
215+
# - extralagefile (ex: test_zipfile64): really too slow to be enabled
216+
# "by default"
217+
# - tzdata: while needed to validate fully test_datetime, it makes
218+
# test_datetime too slow (15-20 min on some buildbots) and so is disabled by
219+
# default (see bpo-30822).
220+
RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata')
212221

213222
# When tests are run from the Python build directory, it is best practice
214223
# to keep the test files in a subfolder. This eases the cleanup of leftover
@@ -432,7 +441,7 @@ def _parse_args(args, **kwargs):
432441
for a in ns.use:
433442
for r in a:
434443
if r == 'all':
435-
ns.use_resources[:] = RESOURCE_NAMES
444+
ns.use_resources[:] = ALL_RESOURCES
436445
continue
437446
if r == 'none':
438447
del ns.use_resources[:]

Lib/test/test_regrtest.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,26 @@ def test_use(self):
192192
with self.subTest(opt=opt):
193193
ns = regrtest._parse_args([opt, 'gui,network'])
194194
self.assertEqual(ns.use_resources, ['gui', 'network'])
195+
195196
ns = regrtest._parse_args([opt, 'gui,none,network'])
196197
self.assertEqual(ns.use_resources, ['network'])
197-
expected = list(regrtest.RESOURCE_NAMES)
198+
199+
expected = list(regrtest.ALL_RESOURCES)
198200
expected.remove('gui')
199201
ns = regrtest._parse_args([opt, 'all,-gui'])
200202
self.assertEqual(ns.use_resources, expected)
201203
self.checkError([opt], 'expected one argument')
202204
self.checkError([opt, 'foo'], 'invalid resource')
203205

206+
# all + a resource not part of "all"
207+
ns = regrtest._parse_args([opt, 'all,tzdata'])
208+
self.assertEqual(ns.use_resources,
209+
list(regrtest.ALL_RESOURCES) + ['tzdata'])
210+
211+
# test another resource which is not part of "all"
212+
ns = regrtest._parse_args([opt, 'extralargefile'])
213+
self.assertEqual(ns.use_resources, ['extralargefile'])
214+
204215
def test_memlimit(self):
205216
for opt in '-M', '--memlimit':
206217
with self.subTest(opt=opt):
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
regrtest: Exclude tzdata from regrtest --all. When running the test suite
2+
using --use=all / -u all, exclude tzdata since it makes test_datetime too
3+
slow (15-20 min on some buildbots) which then times out on some buildbots.
4+
Fix also regrtest command line parser to allow passing -u extralargefile to
5+
run test_zipfile64.

0 commit comments

Comments
 (0)