From 6922ce8e5305c71373f01cc44dbeb975f7dc91dd Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 16:44:59 +0200 Subject: [PATCH 01/10] Backport CI config from master * Add .travis.yml for Travis CI * Add .github/ for AppVeyor and CodeCov. --- .github/CONTRIBUTING.rst | 47 +++++++++++++++++ .github/appveyor.yml | 28 ++++++++++ .github/codecov.yml | 30 +++++++++++ .travis.yml | 111 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 216 insertions(+) create mode 100644 .github/CONTRIBUTING.rst create mode 100644 .github/appveyor.yml create mode 100644 .github/codecov.yml create mode 100644 .travis.yml diff --git a/.github/CONTRIBUTING.rst b/.github/CONTRIBUTING.rst new file mode 100644 index 00000000000000..83cfee34b45cfb --- /dev/null +++ b/.github/CONTRIBUTING.rst @@ -0,0 +1,47 @@ +Contributing to Python +====================== + +Build Status +------------ + +- master + + + `Stable buildbots `_ + +- 3.6 + + + `Stable buildbots `_ + +- 3.5 + + + `Stable buildbots `_ + +- 2.7 + + + `Stable buildbots `_ + + +Contribution Guidelines +----------------------- +Please read the `devguide `_ for +guidance on how to contribute to this project. The documentation covers +everything from how to build the code to submitting a pull request. There are +also suggestions on how you can most effectively help the project. + +Please be aware that our workflow does deviate slightly from the typical GitHub +project. Details on how to properly submit a pull request are covered in +`Lifecycle of a Pull Request `_. +One key point is to keep comments on GitHub to only those related to the reviewing +the code in the pull request. All other discussions -- e.g. about the issue being +fixed -- should happen on bugs.python.org. + +If you are making a code contribution or large documentation contribution, +please feel free to add yourself to the ``Misc/ACKS`` file alphabetically. + + +Code of Conduct +--------------- +All interactions for this project are covered by the +`PSF Code of Conduct `_. Everyone is +expected to be open, considerate, and respectful of others no matter their +position within the project. diff --git a/.github/appveyor.yml b/.github/appveyor.yml new file mode 100644 index 00000000000000..0f4c174fa72aa2 --- /dev/null +++ b/.github/appveyor.yml @@ -0,0 +1,28 @@ +version: 3.7.0a0.{build} +clone_depth: 5 +branches: + only: + - master + - /\d\.\d/ + - buildbot-custom +build_script: +- cmd: PCbuild\build.bat -e +test_script: +- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + +# Only trigger AppVeyor if actual code or its configuration changes +only_commits: + files: + - .github/appveyor.yml + - .gitattributes + - Grammar/ + - Include/ + - Lib/ + - Modules/ + - Objects/ + - PC/ + - PCBuild/ + - Parser/ + - Programs/ + - Python/ + - Tools/ diff --git a/.github/codecov.yml b/.github/codecov.yml new file mode 100644 index 00000000000000..9d97dfbc43f8d0 --- /dev/null +++ b/.github/codecov.yml @@ -0,0 +1,30 @@ +codecov: + strict_yaml_branch: master + notify: + require_ci_to_pass: true +comment: off +ignore: + - "Doc/**/*" + - "Misc/*" + - "Mac/**/*" + - "PC/**/*" + - "PCbuild/**/*" + - "Tools/**/*" + - "Grammar/*" +coverage: + precision: 2 + range: 70...90 + round: down + status: + changes: off + project: off + patch: off +parsers: + gcov: + branch_detection: + conditional: true + loop: true + macro: false + method: false + javascript: + enable_partials: false diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000000..4be6e4c2154079 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,111 @@ +language: c +dist: trusty +sudo: false +group: beta + +# To cache doc-building dependencies. +cache: pip + +branches: + only: + - master + - /^\d\.\d$/ + +matrix: + fast_finish: true + allow_failures: + - env: OPTIONAL=true + include: + - os: linux + language: c + compiler: clang + # gcc also works, but to keep the # of concurrent builds down, we use one C + # compiler here and the other to run the coverage build. Clang is preferred + # in this instance for its better error messages. + env: TESTING=cpython + - os: osx + language: c + compiler: clang + # Testing under macOS is optional until testing stability has been demonstrated. + env: OPTIONAL=true + before_install: + - brew install openssl xz + - export CPPFLAGS="-I$(brew --prefix openssl)/include" + - export LDFLAGS="-L$(brew --prefix openssl)/lib" + - os: linux + language: python + # Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs. + python: 3.6 + env: TESTING=docs + before_script: + - cd Doc + # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures. + # (Updating the version is fine as long as no warnings are raised by doing so.) + - python -m pip install sphinx~=1.6.1 + script: + - make check suspicious html SPHINXOPTS="-q -W -j4" + - os: linux + language: c + compiler: gcc + env: OPTIONAL=true + before_script: + - | + if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.rst$)|(^Doc)|(^Misc)' + then + echo "Only docs were updated, stopping build process." + exit + fi + ./configure + make -s -j4 + # Need a venv that can parse covered code. + ./python -m venv venv + ./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 + 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 + - bash <(curl -s https://codecov.io/bash) + +# Travis provides only 2 cores, so don't overdo the parallelism and waste memory. +before_script: + - | + set -e + if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.rst$)|(^Doc)|(^Misc)' + then + echo "Only docs were updated, stopping build process." + exit + fi + ./configure --with-pydebug + make -j4 + make -j4 regen-all clinic + changes=`git status --porcelain` + if ! test -z "$changes" + then + echo "Generated files not up to date" + echo "$changes" + exit 1 + fi + +script: + # Using the built Python as patchcheck.py is built around the idea of using + # a checkout-build of CPython to know things like what base branch the changes + # should be compared against. + # 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" + +notifications: + email: false + irc: + channels: + # This is set to a secure variable to prevent forks from notifying the + # IRC channel whenever they fail a build. This can be removed when travis + # implements https://github.com/travis-ci/travis-ci/issues/1094. + # The actual value here is: irc.freenode.net#python-dev + - secure: "s7kAkpcom2yUJ8XqyjFI0obJmhAGrn1xmoivdaPdgBIA++X47TBp1x4pgDsbEsoalef7bEwa4l07KdT4qa+DOd/c4QxaWom7fbN3BuLVsZuVfODnl79+gYq/TAbGfyH+yDs18DXrUfPgwD7C5aW32ugsqAOd4iWzfGJQ5OrOZzqzGjYdYQUEkJFXgxDEIb4aHvxNDWGO3Po9uKISrhb5saQ0l776yLo1Ur7M4oxl8RTbCdgX0vf5TzPg52BgvZpOgt3DHOUYPeiJLKNjAE6ibg0U95sEvMfHX77nz4aFY4/3UI6FFaRla34rZ+mYKrn0TdxOhera1QOgPmM6HzdO4K44FpfK1DS0Xxk9U9/uApq+cG0bU3W+cVUHDBe5+90lpRBAXHeHCgT7TI8gec614aiT8lEr3+yH8OBRYGzkjNK8E2LJZ/SxnVxDe7aLF6AWcoWLfS6/ziAIBFQ5Nc4U72CT8fGVSkl8ywPiRlvixKdvTODMSZo0jMqlfZSNaAPTsNRx4wu5Uis4qekwe32Fz4aB6KGpsuuVjBi+H6v0RKxNJNGY3JKDiEH2TK0UE2auJ5GvLW48aUVFcQMB7euCWYXlSWVRHh3WLU8QXF29Dw4JduRZqUpOdRgMHU79UHRq+mkE0jAS/nBcS6CvsmxCpTSrfVYuMOu32yt18QQoTyU=" + on_success: change + on_failure: always + skip_join: true From b29822161abf9d8b66d10817994a7be7ad892e2c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 16:56:26 +0200 Subject: [PATCH 02/10] Travis CI: remove "make regen-all" check The regen-all Makefile rule doesn't exist in Python 3.4, only since Python 3.5 and newer (and 2.7). --- .github/codecov.yml | 30 ------------------------------ .travis.yml | 8 -------- 2 files changed, 38 deletions(-) delete mode 100644 .github/codecov.yml diff --git a/.github/codecov.yml b/.github/codecov.yml deleted file mode 100644 index 9d97dfbc43f8d0..00000000000000 --- a/.github/codecov.yml +++ /dev/null @@ -1,30 +0,0 @@ -codecov: - strict_yaml_branch: master - notify: - require_ci_to_pass: true -comment: off -ignore: - - "Doc/**/*" - - "Misc/*" - - "Mac/**/*" - - "PC/**/*" - - "PCbuild/**/*" - - "Tools/**/*" - - "Grammar/*" -coverage: - precision: 2 - range: 70...90 - round: down - status: - changes: off - project: off - patch: off -parsers: - gcov: - branch_detection: - conditional: true - loop: true - macro: false - method: false - javascript: - enable_partials: false diff --git a/.travis.yml b/.travis.yml index 4be6e4c2154079..46b287f9d9d156 100644 --- a/.travis.yml +++ b/.travis.yml @@ -79,14 +79,6 @@ before_script: fi ./configure --with-pydebug make -j4 - make -j4 regen-all clinic - changes=`git status --porcelain` - if ! test -z "$changes" - then - echo "Generated files not up to date" - echo "$changes" - exit 1 - fi script: # Using the built Python as patchcheck.py is built around the idea of using From 10f9ce033adc8ef5eb693fdcdb41c5d26daa073e Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 17:02:50 +0200 Subject: [PATCH 03/10] appveyor: replace --slowest with --slow --- .github/appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 0f4c174fa72aa2..54a1affb5f071e 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -8,7 +8,7 @@ branches: build_script: - cmd: PCbuild\build.bat -e test_script: -- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 +- cmd: PCbuild\rt.bat -q -uall -u-cpu -rwW --slow --timeout=1200 -j0 # Only trigger AppVeyor if actual code or its configuration changes only_commits: From 265f464b4b559d942c6a2c67e9296b9519b0294c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 17:11:52 +0200 Subject: [PATCH 04/10] Travis CI: remove the GCC coverage job --- .travis.yml | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46b287f9d9d156..dbaad6b376de61 100644 --- a/.travis.yml +++ b/.travis.yml @@ -44,29 +44,6 @@ matrix: - python -m pip install sphinx~=1.6.1 script: - make check suspicious html SPHINXOPTS="-q -W -j4" - - os: linux - language: c - compiler: gcc - env: OPTIONAL=true - before_script: - - | - if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.rst$)|(^Doc)|(^Misc)' - then - echo "Only docs were updated, stopping build process." - exit - fi - ./configure - make -s -j4 - # Need a venv that can parse covered code. - ./python -m venv venv - ./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 - 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 - - bash <(curl -s https://codecov.io/bash) # Travis provides only 2 cores, so don't overdo the parallelism and waste memory. before_script: From 681bb412217f3dc8f7a3597de9f19e4f1c24d687 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 17:12:31 +0200 Subject: [PATCH 05/10] Travis CI: remove tzdata resource from regrtest tzdata resource doesn't exist in Python 3.4. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index dbaad6b376de61..334815ace161fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,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 a7ed6faf6d0805d4321f13d0530d1a56839ee951 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 17:29:26 +0200 Subject: [PATCH 06/10] Travis CI: remove the doc job Fixing Sphinx warnings requires to backport huge intrusive changes like: - commit d97b7dc94b19063f0589d401bdc4aaadc7030762 - commit 5c6793394066b012b9674681b0815667938ce4d9 --- .travis.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 334815ace161fc..169ec5c51e0872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,18 +32,6 @@ matrix: - brew install openssl xz - export CPPFLAGS="-I$(brew --prefix openssl)/include" - export LDFLAGS="-L$(brew --prefix openssl)/lib" - - os: linux - language: python - # Build the docs against a stable version of Python so code bugs don't hold up doc-related PRs. - python: 3.6 - env: TESTING=docs - before_script: - - cd Doc - # Sphinx is pinned so that new versions that introduce new warnings won't suddenly cause build failures. - # (Updating the version is fine as long as no warnings are raised by doing so.) - - python -m pip install sphinx~=1.6.1 - script: - - make check suspicious html SPHINXOPTS="-q -W -j4" # Travis provides only 2 cores, so don't overdo the parallelism and waste memory. before_script: From 457fb5d168533accd154a40546a93a027cf68db4 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 28 Jun 2017 17:33:20 +0200 Subject: [PATCH 07/10] appveyor: set version to 3.4.6+ --- .github/appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/appveyor.yml b/.github/appveyor.yml index 54a1affb5f071e..e71346fa2b2e73 100644 --- a/.github/appveyor.yml +++ b/.github/appveyor.yml @@ -1,4 +1,4 @@ -version: 3.7.0a0.{build} +version: 3.4.6+.{build} clone_depth: 5 branches: only: From 14c13a5215578d0d35bcda24a2df1c74e3b0d152 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 14 Jun 2017 22:43:02 +0200 Subject: [PATCH 08/10] bpo-30231: Remove skipped test_imaplib tests (#1419) (#2193) The public cyrus.andrew.cmu.edu IMAP server (port 993) doesn't accept TLS connection using our self-signed x509 certificate. Remove the two tests which are already skipped. (cherry picked from commit 7895a0585b4b6a1c8082d17227307c6ce2c8bb8b) --- Lib/test/test_imaplib.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py index 838411e76fe691..68a710561327f6 100644 --- a/Lib/test/test_imaplib.py +++ b/Lib/test/test_imaplib.py @@ -468,16 +468,6 @@ def test_logincapa(self): _server = self.imap_class(self.host, self.port) self.check_logincapa(_server) - def test_logincapa_with_client_certfile(self): - with transient_internet(self.host): - _server = self.imap_class(self.host, self.port, certfile=CERTFILE) - self.check_logincapa(_server) - - def test_logincapa_with_client_ssl_context(self): - with transient_internet(self.host): - _server = self.imap_class(self.host, self.port, ssl_context=self.create_ssl_context()) - self.check_logincapa(_server) - def test_logout(self): with transient_internet(self.host): _server = self.imap_class(self.host, self.port) From 2143f317427f2bb3a8f5d12f00b16ca6bd189a08 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 8 Mar 2016 16:11:26 +0200 Subject: [PATCH 09/10] Issues #23808, #25911: Trying to fix walk tests on Windows. On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag. (cherry picked from commit 388b90f28e029daaf06aae8026b596e2f20a1cd3) --- Lib/test/test_os.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index e29b0d585c7230..c5f5937889f76b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -770,7 +770,11 @@ def setUp(self): if support.can_symlink(): os.symlink(os.path.abspath(t2_path), self.link_path) os.symlink('broken', broken_link_path, True) - self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"]) + if os.path.isdir(broken_link_path): + # On Windows a symlink can has the FILE_ATTRIBUTE_DIRECTORY flag. + self.sub2_tree = (sub2_path, ["broken_link", "link"], ["tmp3"]) + else: + self.sub2_tree = (sub2_path, ["link"], ["broken_link", "tmp3"]) else: self.sub2_tree = (sub2_path, [], ["tmp3"]) From 577f92627b7bc69999ea26a685d9ab37e25acdbf Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 12 Jul 2017 17:31:53 +0300 Subject: [PATCH 10/10] bpo-30730: Fix test_os tests. Fix test_invalid_cmd() and test_invalid_env(), TypeError is raised on Python 3.4. (cherry picked from commit 5e22721e586344b547194f0f7ea67fd425f94e72) --- Lib/test/test_subprocess.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 19b140239439cf..6d55f9bbf34ba4 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -609,24 +609,24 @@ def test_empty_env(self): def test_invalid_cmd(self): # null character in the command name cmd = sys.executable + '\0' - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): subprocess.Popen([cmd, "-c", "pass"]) # null character in the command argument - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): subprocess.Popen([sys.executable, "-c", "pass#\0"]) def test_invalid_env(self): # null character in the enviroment variable name newenv = os.environ.copy() newenv["FRUIT\0VEGETABLE"] = "cabbage" - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) # null character in the enviroment variable value newenv = os.environ.copy() newenv["FRUIT"] = "orange\0VEGETABLE=cabbage" - with self.assertRaises(ValueError): + with self.assertRaises((ValueError, TypeError)): subprocess.Popen([sys.executable, "-c", "pass"], env=newenv) # equal character in the enviroment variable name