diff --git a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy index 48a14703ce24..27b7ecb7f09a 100644 --- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy +++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy @@ -1556,7 +1556,7 @@ class BeamModulePlugin implements Plugin { project.exec { commandLine 'virtualenv', "${project.ext.envdir}" } project.exec { executable 'sh' - args '-c', ". ${project.ext.envdir}/bin/activate && pip install --retries 10 --upgrade tox==3.0.0 grpcio-tools==1.3.5" + args '-c', ". ${project.ext.envdir}/bin/activate && pip install --retries 10 --upgrade tox==3.7.0 grpcio-tools==1.3.5" } } // Gradle will delete outputs whenever it thinks they are stale. Putting a diff --git a/sdks/python/build.gradle b/sdks/python/build.gradle index 860301ed7ff4..7a5f9f5e4949 100644 --- a/sdks/python/build.gradle +++ b/sdks/python/build.gradle @@ -100,13 +100,11 @@ assemble.dependsOn docs toxTask "cover", "cover" +toxTask "testsInParallel", "py27,py3,py27-gcp,py27-lint,py27-lint3,py3-lint,docs" + task preCommit() { - dependsOn "docs" + dependsOn "testsInParallel" dependsOn "testCython" - dependsOn "testPython2" - dependsOn "testPython3" - dependsOn "testGcp" - dependsOn "lint" } task portablePreCommit() { diff --git a/sdks/python/scripts/run_tox.sh b/sdks/python/scripts/run_tox.sh index 24ccb205913e..239f8991e3f9 100755 --- a/sdks/python/scripts/run_tox.sh +++ b/sdks/python/scripts/run_tox.sh @@ -41,7 +41,12 @@ if [[ "*sdks/python" != $PWD ]]; then cd $(pwd | sed 's/sdks\/python.*/sdks\/python/') fi -tox -c tox.ini --recreate -e $1 +# check if multiple envs are provided. Then we can run them in parallel. +if [[ $1 == *","* ]]; then + parallel='-p all -o' +fi + +tox -c tox.ini --recreate -e $1 $parallel exit_code=$? # Retry once for the specific exit code 245. if [[ $exit_code == 245 ]]; then