You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/08/28 01:19:36 UTC
[GitHub] [beam] tvalentyn commented on a change in pull request #12673: [BEAM-9944] made run_pytest allow options to indicate specific test package
tvalentyn commented on a change in pull request #12673:
URL: https://github.com/apache/beam/pull/12673#discussion_r478777091
##########
File path: sdks/python/scripts/run_pytest.sh
##########
@@ -21,19 +21,71 @@
# exit statuses of runs, special-casing 5, which says that no tests were
# selected.
#
+# Arguments:
# $1 - suite base name
# $2 - additional arguments to pass to pytest
+#
+# Options:
+# --cov - code directory to report coverage
+# --cov-report - code coverage report format
+# -p, --package - package names need to be tested
+#
+# Example usages:
+# - Run all tests and generate coverage report
+# `$ ./run_pytest.sh envname posargs --cov-report xml:codecov.xml --cov apache_beam`
+# - Run tests under apache_beam.typehints and apache_beam.options packages
+# `$ ./run_pytest.sh envname posargs -p apache_beam.typehints -p apache_beam.options
+
+test_packages=""
-envname=${1?First argument required: suite base name}
-posargs=$2
-coverage_report=$3
-coverage_root=$4
+check_argument_existence() {
+ if [[ -z "$2" ]] || [[ "$2" =~ ^-+ ]]; then
+ echo "Argument is required for this option: $1" 1>&2
+ exit 1
+ fi
+}
+
+for OPT in "$@"
+do
+ case $OPT in
+ -p | --package)
+ check_argument_existence "$1" "$2"
+ test_packages="${test_packages}${2} "
Review comment:
isn't `${test_packages}` empty?
##########
File path: sdks/python/scripts/run_pytest.sh
##########
@@ -21,19 +21,71 @@
# exit statuses of runs, special-casing 5, which says that no tests were
# selected.
#
+# Arguments:
# $1 - suite base name
# $2 - additional arguments to pass to pytest
+#
+# Options:
+# --cov - code directory to report coverage
+# --cov-report - code coverage report format
+# -p, --package - package names need to be tested
+#
+# Example usages:
+# - Run all tests and generate coverage report
+# `$ ./run_pytest.sh envname posargs --cov-report xml:codecov.xml --cov apache_beam`
Review comment:
What are valid examples for envname and posargs? Can we list them here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org