diff --git a/.test-infra/jenkins/README.md b/.test-infra/jenkins/README.md index c596daf8ba48..932a7f89d646 100644 --- a/.test-infra/jenkins/README.md +++ b/.test-infra/jenkins/README.md @@ -45,6 +45,11 @@ Beam Jenkins overview page: [link](https://ci-beam.apache.org/) | beam_PreCommit_Portable_Python | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Phrase/) | `Run Portable_Python PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Portable_Python_Cron) | | beam_PreCommit_PythonLint | [commit](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Phrase/) | `Run PythonLint PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonLint_Cron) | | beam_PreCommit_Python | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Phrase/) | `Run Python PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Cron) | +| beam_PreCommit_Python_Integration | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Integration_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Integration_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Integration_Phrase/) | `Run Python_Integration PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Integration_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Integration_Cron) | +| beam_PreCommit_Python_Dataframes | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Dataframes_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Dataframes_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Dataframes_Phrase/) | `Run Python_Dataframes PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Dataframes_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Dataframes_Cron) | +| beam_PreCommit_Python_Examples | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Examples_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Examples_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Examples_Phrase/) | `Run Python_Examples PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Examples_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Examples_Cron) | +| beam_PreCommit_Python_Runners | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Runners_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Runners_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Runners_Phrase/) | `Run Python_Runners PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Runners_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Runners_Cron) | +| beam_PreCommit_Python_Transforms | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_Transforms_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_Transforms_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_Transforms_Phrase/) | `Run Python_Transforms PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_Transforms_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_Transforms_Cron) | | beam_PreCommit_PythonDocker | [commit](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Phrase/) | `Run PythonDocker PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocker_Cron/) | | beam_PreCommit_PythonDocs| [commit](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Phrase/) | `Run PythonDocs PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_PythonDocs_Cron/) | | beam_PreCommit_Python_PVR_Flink | [commit](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Commit/), [cron](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/), [phrase](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Phrase/) | `Run Python_PVR_Flink PreCommit` | [![Build Status](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron/badge/icon)](https://ci-beam.apache.org/job/beam_PreCommit_Python_PVR_Flink_Cron) | diff --git a/.test-infra/jenkins/job_PreCommit_Python.groovy b/.test-infra/jenkins/job_PreCommit_Python.groovy index 0b5270f96eef..313a7716f607 100644 --- a/.test-infra/jenkins/job_PreCommit_Python.groovy +++ b/.test-infra/jenkins/job_PreCommit_Python.groovy @@ -27,6 +27,9 @@ PrecommitJobBuilder builder = new PrecommitJobBuilder( '^model/.*$', '^sdks/python/.*$', '^release/.*$', + ], + gradleSwitches: [ + '-Pposargs=\"--ignore=apache_beam/dataframe/ --ignore=apache_beam/examples/ --ignore=apache_beam/runners/ --ignore=apache_beam/transforms/\"' // All these tests are covered by different jobs. ] ) builder.build { diff --git a/.test-infra/jenkins/job_PreCommit_PythonIT.groovy b/.test-infra/jenkins/job_PreCommit_PythonIT.groovy new file mode 100644 index 000000000000..21d249647e8b --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_PythonIT.groovy @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Integration', + gradleTask: ':pythonPreCommitIT', + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} \ No newline at end of file diff --git a/.test-infra/jenkins/job_PreCommit_Python_Dataframes.groovy b/.test-infra/jenkins/job_PreCommit_Python_Dataframes.groovy new file mode 100644 index 000000000000..e2914e9bdb8e --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_Python_Dataframes.groovy @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Dataframes', + gradleTask: ':pythonPreCommit', + gradleSwitches: [ + '-Pposargs=apache_beam/dataframe/' + ], + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} \ No newline at end of file diff --git a/.test-infra/jenkins/job_PreCommit_Python_Examples.groovy b/.test-infra/jenkins/job_PreCommit_Python_Examples.groovy new file mode 100644 index 000000000000..f4ef9f51d7fb --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_Python_Examples.groovy @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Examples', + gradleTask: ':pythonPreCommit', + gradleSwitches: [ + '-Pposargs=apache_beam/examples/' + ], + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} \ No newline at end of file diff --git a/.test-infra/jenkins/job_PreCommit_Python_Runners.groovy b/.test-infra/jenkins/job_PreCommit_Python_Runners.groovy new file mode 100644 index 000000000000..e80dba6cf5cd --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_Python_Runners.groovy @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Runners', + gradleTask: ':pythonPreCommit', + gradleSwitches: [ + '-Pposargs=apache_beam/runners/' + ], + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} \ No newline at end of file diff --git a/.test-infra/jenkins/job_PreCommit_Python_Transforms.groovy b/.test-infra/jenkins/job_PreCommit_Python_Transforms.groovy new file mode 100644 index 000000000000..dd16d48b1731 --- /dev/null +++ b/.test-infra/jenkins/job_PreCommit_Python_Transforms.groovy @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import PrecommitJobBuilder + +PrecommitJobBuilder builder = new PrecommitJobBuilder( + scope: this, + nameBase: 'Python_Transforms', + gradleTask: ':pythonPreCommit', + gradleSwitches: [ + '-Pposargs=apache_beam/transforms/' + ], + timeoutMins: 180, + triggerPathPatterns: [ + '^model/.*$', + '^sdks/python/.*$', + '^release/.*$', + ] + ) +builder.build { + // Publish all test results to Jenkins. + publishers { + archiveJunit('**/pytest*.xml') + } +} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index e146a4741481..01423965aa8d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -420,6 +420,10 @@ tasks.register("pythonPreCommit") { dependsOn(":sdks:python:test-suites:tox:py38:preCommitPy38") dependsOn(":sdks:python:test-suites:tox:py39:preCommitPy39") dependsOn(":sdks:python:test-suites:tox:py310:preCommitPy310") +} + +tasks.register("pythonPreCommitIT") { + dependsOn(":sdks:python:test-suites:tox:pycommon:preCommitPyCommon") dependsOn(":sdks:python:test-suites:dataflow:preCommitIT") dependsOn(":sdks:python:test-suites:dataflow:preCommitIT_V2") } diff --git a/sdks/python/scripts/run_pytest.sh b/sdks/python/scripts/run_pytest.sh index 6c7d5c46e78e..01f2318164c4 100755 --- a/sdks/python/scripts/run_pytest.sh +++ b/sdks/python/scripts/run_pytest.sh @@ -35,6 +35,11 @@ if [[ $pytest_args =~ "-m" ]] || [[ $posargs =~ "-m" ]]; then exit 1 fi +# strip leading/trailing quotes from posargs because it can get double quoted as its passed through. +posargs=$(sed -e 's/^"//' -e 's/"$//' -e "s/'$//" -e "s/^'//" <<<$posargs) +echo "pytest_args: $pytest_args" +echo "posargs: $posargs" + # Run with pytest-xdist and without. pytest -o junit_suite_name=${envname} \ --junitxml=pytest_${envname}.xml -m 'not no_xdist' -n 6 ${pytest_args} --pyargs ${posargs} diff --git a/sdks/python/test-suites/tox/common.gradle b/sdks/python/test-suites/tox/common.gradle index 61802ac9c45e..5f5a1012f563 100644 --- a/sdks/python/test-suites/tox/common.gradle +++ b/sdks/python/test-suites/tox/common.gradle @@ -18,19 +18,21 @@ def pythonVersionSuffix = project.ext.pythonVersion.replace('.', '') -toxTask "testPython${pythonVersionSuffix}", "py${pythonVersionSuffix}" +def posargs = project.findProperty("posargs") ?: "" + +toxTask "testPython${pythonVersionSuffix}", "py${pythonVersionSuffix}", "${posargs}" test.dependsOn "testPython${pythonVersionSuffix}" -toxTask "testPy${pythonVersionSuffix}Cloud", "py${pythonVersionSuffix}-cloud" +toxTask "testPy${pythonVersionSuffix}Cloud", "py${pythonVersionSuffix}-cloud", "${posargs}" test.dependsOn "testPy${pythonVersionSuffix}Cloud" -toxTask "testPy${pythonVersionSuffix}Dask", "py${pythonVersionSuffix}-dask" +toxTask "testPy${pythonVersionSuffix}Dask", "py${pythonVersionSuffix}-dask", "${posargs}" test.dependsOn "testPy${pythonVersionSuffix}Dask" -toxTask "testPy${pythonVersionSuffix}Cython", "py${pythonVersionSuffix}-cython" +toxTask "testPy${pythonVersionSuffix}Cython", "py${pythonVersionSuffix}-cython", "${posargs}" test.dependsOn "testPy${pythonVersionSuffix}Cython" -toxTask "testPy38CloudCoverage", "py38-cloudcoverage" +toxTask "testPy38CloudCoverage", "py38-cloudcoverage", "${posargs}" test.dependsOn "testPy38CloudCoverage" project.tasks.register("preCommitPy${pythonVersionSuffix}") { diff --git a/sdks/python/test-suites/tox/py37/build.gradle b/sdks/python/test-suites/tox/py37/build.gradle index 2ea0e46ca5be..744ca6750629 100644 --- a/sdks/python/test-suites/tox/py37/build.gradle +++ b/sdks/python/test-suites/tox/py37/build.gradle @@ -26,13 +26,15 @@ applyPythonNature() // Required to setup a Python 3 virtualenv and task names. pythonVersion = '3.7' +def posargs = project.findProperty("posargs") ?: "" + task lint {} check.dependsOn lint -toxTask "lintPy37", "py37-lint" +toxTask "lintPy37", "py37-lint", "${posargs}" lint.dependsOn lintPy37 -toxTask "mypyPy37", "py37-mypy" +toxTask "mypyPy37", "py37-mypy", "${posargs}" lint.dependsOn mypyPy37 apply from: "../common.gradle" diff --git a/sdks/python/test-suites/tox/py38/build.gradle b/sdks/python/test-suites/tox/py38/build.gradle index f51eec00da0e..aa52e3736d48 100644 --- a/sdks/python/test-suites/tox/py38/build.gradle +++ b/sdks/python/test-suites/tox/py38/build.gradle @@ -34,79 +34,86 @@ apply from: "../common.gradle" // TODO(https://github.com/apache/beam/issues/20051): Remove this once tox uses isolated builds. testPy38Cython.mustRunAfter testPython38, testPy38CloudCoverage +// TODO(BEAM-12000): Move tasks that aren't specific to 3.8 to Py 3.9. +def posargs = project.findProperty("posargs") ?: "" +def runDataframesTests = (posargs == "" || posargs.contains("dataframes")) +logger.info('Running dataframes tests: ' + runDataframesTests) + // Create a test task for each major version of pyarrow -// TODO(BEAM-12000): Move these to Py 3.9. -toxTask "testPy38pyarrow-0", "py38-pyarrow-0" +toxTask "testPy38pyarrow-0", "py38-pyarrow-0", "${posargs}" test.dependsOn "testPy38pyarrow-0" preCommitPy38.dependsOn "testPy38pyarrow-0" -toxTask "testPy38pyarrow-1", "py38-pyarrow-1" +toxTask "testPy38pyarrow-1", "py38-pyarrow-1", "${posargs}" test.dependsOn "testPy38pyarrow-1" preCommitPy38.dependsOn "testPy38pyarrow-1" -toxTask "testPy38pyarrow-2", "py38-pyarrow-2" +toxTask "testPy38pyarrow-2", "py38-pyarrow-2", "${posargs}" test.dependsOn "testPy38pyarrow-2" preCommitPy38.dependsOn "testPy38pyarrow-2" -toxTask "testPy38pyarrow-3", "py38-pyarrow-3" +toxTask "testPy38pyarrow-3", "py38-pyarrow-3", "${posargs}" test.dependsOn "testPy38pyarrow-3" preCommitPy38.dependsOn "testPy38pyarrow-3" -toxTask "testPy38pyarrow-4", "py38-pyarrow-4" +toxTask "testPy38pyarrow-4", "py38-pyarrow-4", "${posargs}" test.dependsOn "testPy38pyarrow-4" preCommitPy38.dependsOn "testPy38pyarrow-4" -toxTask "testPy38pyarrow-5", "py38-pyarrow-5" +toxTask "testPy38pyarrow-5", "py38-pyarrow-5", "${posargs}" test.dependsOn "testPy38pyarrow-5" preCommitPy38.dependsOn "testPy38pyarrow-5" -toxTask "testPy38pyarrow-6", "py38-pyarrow-6" +toxTask "testPy38pyarrow-6", "py38-pyarrow-6", "${posargs}" test.dependsOn "testPy38pyarrow-6" preCommitPy38.dependsOn "testPy38pyarrow-6" -toxTask "testPy38pyarrow-7", "py38-pyarrow-7" +toxTask "testPy38pyarrow-7", "py38-pyarrow-7", "${posargs}" test.dependsOn "testPy38pyarrow-7" preCommitPy38.dependsOn "testPy38pyarrow-7" -toxTask "testPy38pyarrow-8", "py38-pyarrow-8" +toxTask "testPy38pyarrow-8", "py38-pyarrow-8", "${posargs}" test.dependsOn "testPy38pyarrow-8" preCommitPy38.dependsOn "testPy38pyarrow-8" -toxTask "testPy38pyarrow-9", "py38-pyarrow-9" +toxTask "testPy38pyarrow-9", "py38-pyarrow-9", "${posargs}" test.dependsOn "testPy38pyarrow-9" preCommitPy38.dependsOn "testPy38pyarrow-9" -// Create a test task for each minor version of pandas -toxTask "testPy38pandas-11", "py38-pandas-11" -test.dependsOn "testPy38pandas-11" -preCommitPy38.dependsOn "testPy38pandas-11" +// Dataframes tests won't get auto-filtered by path since they explicitly only run on the dataframes directory in tox.ini +if (runDataframesTests) { + // Create a test task for each minor version of pandas + toxTask "testPy38pandas-11", "py38-pandas-11", "${posargs}" + test.dependsOn "testPy38pandas-11" + preCommitPy38.dependsOn "testPy38pandas-11" -toxTask "testPy38pandas-12", "py38-pandas-12" -test.dependsOn "testPy38pandas-12" -preCommitPy38.dependsOn "testPy38pandas-12" + toxTask "testPy38pandas-12", "py38-pandas-12", "${posargs}" + test.dependsOn "testPy38pandas-12" + preCommitPy38.dependsOn "testPy38pandas-12" -toxTask "testPy38pandas-13", "py38-pandas-13" -test.dependsOn "testPy38pandas-13" -preCommitPy38.dependsOn "testPy38pandas-13" + toxTask "testPy38pandas-13", "py38-pandas-13", "${posargs}" + test.dependsOn "testPy38pandas-13" + preCommitPy38.dependsOn "testPy38pandas-13" -toxTask "testPy38pandas-14", "py38-pandas-14" -test.dependsOn "testPy38pandas-14" -preCommitPy38.dependsOn "testPy38pandas-14" + toxTask "testPy38pandas-14", "py38-pandas-14", "${posargs}" + test.dependsOn "testPy38pandas-14" + preCommitPy38.dependsOn "testPy38pandas-14" -toxTask "testPy38pandas-15", "py38-pandas-15" -test.dependsOn "testPy38pandas-15" -preCommitPy38.dependsOn "testPy38pandas-15" + toxTask "testPy38pandas-15", "py38-pandas-15", "${posargs}" + test.dependsOn "testPy38pandas-15" + preCommitPy38.dependsOn "testPy38pandas-15" +} // Create a test task for each minor version of pytorch -toxTask "testPy38pytorch-19", "py38-pytorch-19" +toxTask "testPy38pytorch-19", "py38-pytorch-19", "${posargs}" test.dependsOn "testPy38pytorch-19" preCommitPy38.dependsOn "testPy38pytorch-19" -toxTask "testPy38pytorch-110", "py38-pytorch-110" +toxTask "testPy38pytorch-110", "py38-pytorch-110", "${posargs}" test.dependsOn "testPy38pytorch-110" preCommitPy38.dependsOn "testPy38pytorch-110" -toxTask "whitespacelint", "whitespacelint" +toxTask "whitespacelint", "whitespacelint", "${posargs}" task archiveFilesToLint(type: Zip) { archiveFileName = "files-to-whitespacelint.zip" @@ -128,9 +135,9 @@ whitespacelint.dependsOn archiveFilesToLint, unpackFilesToLint unpackFilesToLint.dependsOn archiveFilesToLint archiveFilesToLint.dependsOn cleanPython -toxTask "jest", "jest" +toxTask "jest", "jest", "${posargs}" -toxTask "eslint", "eslint" +toxTask "eslint", "eslint", "${posargs}" task copyTsSource(type: Copy) { from ("$rootProject.projectDir") { diff --git a/sdks/python/tox.ini b/sdks/python/tox.ini index 2efa81ab2033..e5aecff48883 100644 --- a/sdks/python/tox.ini +++ b/sdks/python/tox.ini @@ -296,8 +296,9 @@ commands = # Log pyarrow and numpy version for debugging /bin/sh -c "pip freeze | grep -E '(pyarrow|numpy)'" # Run pytest directly rather using run_pytest.sh. It doesn't handle - # selecting tests with -m (BEAM-12985) - pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_pyarrow {posargs} + # selecting tests with -m (BEAM-12985). + # Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories. + /bin/sh -c 'pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_pyarrow {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret' [testenv:py{37,38,39,310}-pandas-{11,12,13,14,15}] deps = @@ -323,4 +324,5 @@ commands = # Log torch version for debugging /bin/sh -c "pip freeze | grep -E torch" # Run all PyTorch unit tests - pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_pytorch {posargs} + # Allow exit code 5 (no tests run) so that we can run this command safely on arbitrary subdirectories. + /bin/sh -c 'pytest -o junit_suite_name={envname} --junitxml=pytest_{envname}.xml -n 6 -m uses_pytorch {posargs}; ret=$?; [ $ret = 5 ] && exit 0 || exit $ret'