From 9d2ba7cf1bcc22dca7f4fd7e0c5d78ea30610905 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Jul 2017 13:39:08 +0200 Subject: [PATCH 1/4] bpo-30822: Exclude tzdata from regrtest --all 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. --- Lib/test/libregrtest/cmdline.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index 2315cd59b4e679..c98f2eac8b5491 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -127,8 +127,17 @@ """ -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', - 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'tzdata') +ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network', + 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'tzdata') + +# Other resources excluded from --use=all: +# +# - extralagefile (ex: test_zipfile64): really too slow to be enabled +# "by default" +# - tzdata: while needed to validate fully test_datetime, it makes +# test_datetime too slow (15-20 min on some buildbots) and so is disabled by +# default (see bpo-30822). +RESOURCE_NAMES = ALL_RESOURCES + ('extralargefile', 'tzdata') class _ArgParser(argparse.ArgumentParser): @@ -344,7 +353,7 @@ def _parse_args(args, **kwargs): for a in ns.use: for r in a: if r == 'all': - ns.use_resources[:] = RESOURCE_NAMES + ns.use_resources[:] = ALL_RESOURCES continue if r == 'none': del ns.use_resources[:] From cf9a725aac2add8b793e189c6b8d6e8b7beb9c7f Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Jul 2017 14:26:35 +0200 Subject: [PATCH 2/4] Travis CI: remove -tzdata Replace -u all,-tzdata,-cpu with -u all,-cpu since tzdata is now excluded from -u all. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4be6e4c2154079..ba1e417c633af8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -62,7 +62,7 @@ matrix: ./venv/bin/python -m pip install -U coverage script: # Skip tests that re-run the entire test suite. - - ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu,-tzdata -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn + - ./venv/bin/python -m coverage run --pylib -m test -uall,-cpu -x test_multiprocessing_fork -x test_multiprocessing_forkserver -x test_multiprocessing_spawn after_script: # Probably should be after_success once test suite updated to run under coverage.py. # Make the `coverage` command available to Codecov w/ a version of Python that can parse all source files. - source ./venv/bin/activate @@ -95,7 +95,7 @@ script: # Only run on Linux as the check only needs to be run once. - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./python Tools/scripts/patchcheck.py --travis $TRAVIS_PULL_REQUEST; fi # `-r -w` implicitly provided through `make buildbottest`. - - make buildbottest TESTOPTS="-j4 -uall,-cpu,-tzdata" + - make buildbottest TESTOPTS="-j4 -uall,-cpu" notifications: email: false From dc577a11cfaaf9776f1b0277317903829c712288 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Jul 2017 14:30:00 +0200 Subject: [PATCH 3/4] Add NEWS entry --- .../next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst diff --git a/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst b/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst new file mode 100644 index 00000000000000..53557f66feffa9 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2017-07-20-14-29-54.bpo-30822.X0wREo.rst @@ -0,0 +1,5 @@ +regrtest: Exclude tzdata from regrtest --all. 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. +Fix also regrtest command line parser to allow passing -u extralargefile to +run test_zipfile64. From 8b2524ff5682d65fae64b56bc5748caa804403ae Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 20 Jul 2017 15:29:46 +0200 Subject: [PATCH 4/4] Update unit tests --- Lib/test/libregrtest/__init__.py | 2 +- Lib/test/libregrtest/cmdline.py | 2 +- Lib/test/test_regrtest.py | 13 ++++++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Lib/test/libregrtest/__init__.py b/Lib/test/libregrtest/__init__.py index 7ba0e6e5356166..3427b51b60af86 100644 --- a/Lib/test/libregrtest/__init__.py +++ b/Lib/test/libregrtest/__init__.py @@ -1,5 +1,5 @@ # We import importlib *ASAP* in order to test #15386 import importlib -from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES +from test.libregrtest.cmdline import _parse_args, RESOURCE_NAMES, ALL_RESOURCES from test.libregrtest.main import main diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py index c98f2eac8b5491..4999fa734114a1 100644 --- a/Lib/test/libregrtest/cmdline.py +++ b/Lib/test/libregrtest/cmdline.py @@ -128,7 +128,7 @@ ALL_RESOURCES = ('audio', 'curses', 'largefile', 'network', - 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui', 'tzdata') + 'decimal', 'cpu', 'subprocess', 'urlfetch', 'gui') # Other resources excluded from --use=all: # diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index a544f880d2be01..f63ed647f80e0b 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -191,15 +191,26 @@ def test_use(self): with self.subTest(opt=opt): ns = libregrtest._parse_args([opt, 'gui,network']) self.assertEqual(ns.use_resources, ['gui', 'network']) + ns = libregrtest._parse_args([opt, 'gui,none,network']) self.assertEqual(ns.use_resources, ['network']) - expected = list(libregrtest.RESOURCE_NAMES) + + expected = list(libregrtest.ALL_RESOURCES) expected.remove('gui') ns = libregrtest._parse_args([opt, 'all,-gui']) self.assertEqual(ns.use_resources, expected) self.checkError([opt], 'expected one argument') self.checkError([opt, 'foo'], 'invalid resource') + # all + a resource not part of "all" + ns = libregrtest._parse_args([opt, 'all,tzdata']) + self.assertEqual(ns.use_resources, + list(libregrtest.ALL_RESOURCES) + ['tzdata']) + + # test another resource which is not part of "all" + ns = libregrtest._parse_args([opt, 'extralargefile']) + self.assertEqual(ns.use_resources, ['extralargefile']) + def test_memlimit(self): for opt in '-M', '--memlimit': with self.subTest(opt=opt):