Skip to content

Commit 5b392bb

Browse files
authored
bpo-30822: Exclude tzdata from regrtest --all (#2775)
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.
1 parent 5bffcf3 commit 5b392bb

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ matrix:
6262
./venv/bin/python -m pip install -U coverage
6363
script:
6464
# Skip tests that re-run the entire test suite.
65-
- ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu,-tzdata -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn
65+
- ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn
6666
after_script: # Probably should be after_success once test suite updated to run under coverage.py.
6767
# Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files.
6868
- source ./venv/bin/activate
@@ -95,7 +95,7 @@ script:
9595
# Only run on Linux as the check only needs to be run once.
9696
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi
9797
# `-r -w` implicitly provided through `make buildbottest`.
98-
- make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata"
98+
- make buildbottest TESTOPTS="-j4 -uall,-cpu"
9999

100100
notifications:
101101
email: false

Lib/test/libregrtest/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# We import importlib *ASAP* in order to test #15386
22
import importlib
33

4-
from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES
4+
from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES, ALL_RESOURCES
55
from test.libregrtest.main import main

Lib/test/libregrtest/cmdline.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,17 @@
127127
"""
128128

129129

130-
RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network',
131-
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'tzdata')
130+
ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network',
131+
'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui')
132+
133+
# Other resources excluded from --use=all:
134+
#
135+
# - extralagefile (ex: test_zipfile64): really too slow to be enabled
136+
# "by default"
137+
# - tzdata: while needed to validate fully test_datetime, it makes
138+
# test_datetime too slow (15-20 min on some buildbots) and so is disabled by
139+
# default (see bpo-30822).
140+
RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata')
132141

133142
class _ArgParser(argparse.ArgumentParser):
134143

@@ -344,7 +353,7 @@ def _parse_args(args, **kwargs):
344353
for a in ns.use:
345354
for r in a:
346355
if r == 'all':
347-
ns.use_resources[:] = RESOURCE_NAMES
356+
ns.use_resources[:] = ALL_RESOURCES
348357
continue
349358
if r == 'none':
350359
del ns.use_resources[:]

Lib/test/test_regrtest.py

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

205+
# all + a resource not part of "all"
206+
ns = libregrtest._parse_args([opt, 'all,tzdata'])
207+
self.assertEqual(ns.use_resources,
208+
list(libregrtest.ALL_RESOURCES) + ['tzdata'])
209+
210+
# test another resource which is not part of "all"
211+
ns = libregrtest._parse_args([opt, 'extralargefile'])
212+
self.assertEqual(ns.use_resources, ['extralargefile'])
213+
203214
def test_memlimit(self):
204215
for opt in '-M', '--memlimit':
205216
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)