Change Python kokoro configs to test only their specified version. (#7927)

Using non-versioned scripts for `build_file` means every Python version is
tested (under Tox), and this is multiplied by each Python version running Tox.

For example, when the `python38` config is used to run Tox, the
Tox layer runs on Python 3.8. This then tests all of the Python versions
individually, including, for example, python27 tests.

This change fixes the `build_file` paths to point to the same-pathed build
script. For example, `kokoro/linux/python27/presubmit.cfg` now uses
`kokoro/linux/python27/build.sh`.

Some additional fixes:

*  Use `python -m tox` in tests.sh instead of just `tox`. This helps non-site
   installations of tox, where the `tox` script may not be on `$PATH`.
*  Ensure tox (and other Python build-related packages) are available in
   Python testing images. (New images have been pushed.)
*  Disable `--warnings_as_errors` due to deprecated function.
*  Remove apt lists per [Docker best practices][1].

[1]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
pull/7932/head
David L. Jones 4 years ago committed by GitHub
parent d16bf914bc
commit b774da0d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      kokoro/linux/dockerfile/test/python27/Dockerfile
  2. 10
      kokoro/linux/dockerfile/test/python35/Dockerfile
  3. 10
      kokoro/linux/dockerfile/test/python36/Dockerfile
  4. 10
      kokoro/linux/dockerfile/test/python37/Dockerfile
  5. 10
      kokoro/linux/dockerfile/test/python38/Dockerfile
  6. 2
      kokoro/linux/python27/continuous.cfg
  7. 2
      kokoro/linux/python27/presubmit.cfg
  8. 2
      kokoro/linux/python27_cpp/continuous.cfg
  9. 2
      kokoro/linux/python27_cpp/presubmit.cfg
  10. 2
      kokoro/linux/python35/continuous.cfg
  11. 2
      kokoro/linux/python35/presubmit.cfg
  12. 2
      kokoro/linux/python35_cpp/continuous.cfg
  13. 2
      kokoro/linux/python35_cpp/presubmit.cfg
  14. 2
      kokoro/linux/python36/continuous.cfg
  15. 2
      kokoro/linux/python36/presubmit.cfg
  16. 2
      kokoro/linux/python36_cpp/continuous.cfg
  17. 2
      kokoro/linux/python36_cpp/presubmit.cfg
  18. 2
      kokoro/linux/python37/continuous.cfg
  19. 2
      kokoro/linux/python37/presubmit.cfg
  20. 2
      kokoro/linux/python37_cpp/continuous.cfg
  21. 2
      kokoro/linux/python37_cpp/presubmit.cfg
  22. 2
      kokoro/linux/python38/continuous.cfg
  23. 2
      kokoro/linux/python38/presubmit.cfg
  24. 2
      kokoro/linux/python38_cpp/continuous.cfg
  25. 2
      kokoro/linux/python38_cpp/presubmit.cfg
  26. 5
      python/tox.ini
  27. 4
      tests.sh

@ -20,4 +20,12 @@ RUN apt-get update && apt-get install -y \
parallel \ parallel \
time \ time \
wget \ wget \
&& apt-get clean && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python libraries.
RUN python -m pip install --no-cache-dir --upgrade \
pip \
setuptools \
tox \
wheel

@ -20,4 +20,12 @@ RUN apt-get update && apt-get install -y \
parallel \ parallel \
time \ time \
wget \ wget \
&& apt-get clean && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python libraries.
RUN python -m pip install --no-cache-dir --upgrade \
pip \
setuptools \
tox \
wheel

@ -20,4 +20,12 @@ RUN apt-get update && apt-get install -y \
parallel \ parallel \
time \ time \
wget \ wget \
&& apt-get clean && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python libraries.
RUN python -m pip install --no-cache-dir --upgrade \
pip \
setuptools \
tox \
wheel

@ -20,4 +20,12 @@ RUN apt-get update && apt-get install -y \
parallel \ parallel \
time \ time \
wget \ wget \
&& apt-get clean && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python libraries.
RUN python -m pip install --no-cache-dir --upgrade \
pip \
setuptools \
tox \
wheel

@ -20,4 +20,12 @@ RUN apt-get update && apt-get install -y \
parallel \ parallel \
time \ time \
wget \ wget \
&& apt-get clean && apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python libraries.
RUN python -m pip install --no-cache-dir --upgrade \
pip \
setuptools \
tox \
wheel

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python27/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python27/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python27_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python27_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python35/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python35/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python35_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python35_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python36/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python36/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python36_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python36_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python37/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python37/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python37_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python37_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python38/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python/build.sh" build_file: "protobuf/kokoro/linux/python38/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python38_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -1,7 +1,7 @@
# Config file for running tests in Kokoro # Config file for running tests in Kokoro
# Location of the build script in repository # Location of the build script in repository
build_file: "protobuf/kokoro/linux/python_cpp/build.sh" build_file: "protobuf/kokoro/linux/python38_cpp/build.sh"
timeout_mins: 120 timeout_mins: 120
action { action {

@ -14,7 +14,10 @@ setenv =
commands = commands =
python setup.py -q build_py python setup.py -q build_py
python: python setup.py -q build python: python setup.py -q build
cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension # --warnings_as_errors disabled until we update the Python C extension. See:
# https://github.com/protocolbuffers/protobuf/issues/7930
# cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
cpp: python setup.py -q build --cpp_implementation --compile_static_extension
python: python setup.py -q test -q python: python setup.py -q test -q
cpp: python setup.py -q test -q --cpp_implementation cpp: python setup.py -q test -q --cpp_implementation
python: python setup.py -q test_conformance python: python setup.py -q test_conformance

@ -316,7 +316,7 @@ build_python() {
else else
envlist=py\{27,36\}-python envlist=py\{27,36\}-python
fi fi
tox -e $envlist python -m tox -e $envlist
cd .. cd ..
} }
@ -324,7 +324,7 @@ build_python_version() {
internal_build_cpp internal_build_cpp
cd python cd python
envlist=$1 envlist=$1
tox -e $envlist python -m tox -e $envlist
cd .. cd ..
} }

Loading…
Cancel
Save