@@ -236,22 +236,16 @@ pushd ${SNOWML_DIR}
236236VERSION=$( grep -oE " VERSION = \" [0-9]+\\ .[0-9]+\\ .[0-9]+.*\" " snowflake/ml/version.py| cut -d' "' -f2)
237237echo " Extracted Package Version from code: ${VERSION} "
238238
239- # Generate and copy auto-gen tests with pytest marks .
239+ # Generate and copy auto-gen tests.
240240" ${BAZEL} " " ${BAZEL_ADDITIONAL_STARTUP_FLAGS[@]+" ${BAZEL_ADDITIONAL_STARTUP_FLAGS[@]} " } " build --config=build " ${BAZEL_ADDITIONAL_BUILD_FLAGS[@]+" ${BAZEL_ADDITIONAL_BUILD_FLAGS[@]} " } " //tests/integ/...
241241
242242# Rsync cannot work well with path that has drive letter in Windows,
243243# Thus, rsync has to use relative path instead of absolute ones.
244244
245245rsync -av --exclude ' *.runfiles_manifest' --exclude ' *.runfiles/**' " bazel-bin/tests" .
246246
247- if [[ -n " ${FEATURE_AREAS} " ]]; then
248- # Add pytest marks to all test files based on their feature: tags
249- echo " Adding pytest marks to test files..."
250- ${PYTHON_EXECUTABLE} bazel/add_pytest_marks.py --targets //tests/integ/... --bazel-path " ${BAZEL} "
251- fi
252-
253247# Read environments from optional_dependency_groups.bzl
254- groups=()
248+ groups=(" core " )
255249while IFS= read -r line; do
256250 groups+=(" $line " )
257251done < <( python3 -c '
@@ -265,26 +259,35 @@ with open("bazel/platforms/optional_dependency_groups.bzl", "r") as f:
265259 print(group)
266260' )
267261
268- groups+=(" core" )
269-
270262for i in " ${! groups[@]} " ; do
271263 group=" ${groups[$i]} "
272264
273265 # Compare test required dependencies with wheel pkg dependencies and exclude tests if necessary
274266 EXCLUDE_TESTS=$( mktemp " ${TEMP_TEST_DIR} /exclude_tests_${group} _XXXXX" )
275- ./ci/get_excluded_tests.sh -f " ${EXCLUDE_TESTS} " -m " ${MODE} " -b " ${BAZEL} " -e " ${SF_ENV} " -g " ${group} "
267+
268+ # Add feature area filtering if FEATURE_AREAS is set
269+ if [[ -n " ${FEATURE_AREAS} " ]]; then
270+ echo " Applying feature area filter: ${FEATURE_AREAS} "
271+ ./ci/get_excluded_tests.sh -f " ${EXCLUDE_TESTS} " -m " ${MODE} " -b " ${BAZEL} " -e " ${SF_ENV} " -g " ${group} " -a " ${FEATURE_AREAS} "
272+ else
273+ ./ci/get_excluded_tests.sh -f " ${EXCLUDE_TESTS} " -m " ${MODE} " -b " ${BAZEL} " -e " ${SF_ENV} " -g " ${group} "
274+ fi
276275
277276 # Copy tests into temp directory
278277 pushd " ${TEMP_TEST_DIR} "
279- rsync -av --exclude-from " ${EXCLUDE_TESTS} " " ../${SNOWML_DIR} /tests" " ${group} "
278+
279+ # Copy from snowml root so exclude patterns can use "tests/integ/..." format
280+ rsync -av --exclude-from " ${EXCLUDE_TESTS} " --include=" tests/***" --exclude=" *" " ../${SNOWML_DIR} /" " ${group} /"
280281 popd
281282done
282283
283284" ${BAZEL} " " ${BAZEL_ADDITIONAL_STARTUP_FLAGS[@]+" ${BAZEL_ADDITIONAL_STARTUP_FLAGS[@]} " } " clean --expunge
284285popd
285286
287+
286288# Build snowml package
287289if [ " ${ENV} " = " pip" ]; then
290+ echo " Building snowml package: pip"
288291 # Clean build workspace
289292 rm -f " ${WORKSPACE} " /* .whl
290293
@@ -340,6 +343,7 @@ if [[ "${WITH_SPCS_IMAGE}" = true ]]; then
340343fi
341344
342345# Start testing
346+ echo " Starting testing..."
343347pushd " ${TEMP_TEST_DIR} "
344348
345349# Set up common pytest flag
@@ -350,24 +354,6 @@ COMMON_PYTEST_FLAG+=(--log-cli-level=INFO)
350354COMMON_PYTEST_FLAG+=(-n logical)
351355COMMON_PYTEST_FLAG+=(--timeout=3600)
352356
353- # Add feature area filtering if specified
354- if [[ -n " ${FEATURE_AREAS} " ]]; then
355- # Convert comma-separated list to pytest mark expression
356- # e.g., "jobs,core" becomes "feature_area_jobs or feature_area_core"
357- IFS=' ,' read -ra AREAS <<< " ${FEATURE_AREAS}"
358- MARK_EXPR=" "
359- for i in " ${! AREAS[@]} " ; do
360- area=" ${AREAS[$i]} "
361- if [[ $i -eq 0 ]]; then
362- MARK_EXPR=" feature_area_${area} "
363- else
364- MARK_EXPR=" ${MARK_EXPR} or feature_area_${area} "
365- fi
366- done
367- COMMON_PYTEST_FLAG+=(-m " ${MARK_EXPR} " )
368- echo " Running tests with feature area filter: ${MARK_EXPR} "
369- fi
370-
371357group_exit_codes=()
372358group_coverage_report_files=()
373359
@@ -385,6 +371,7 @@ for i in "${!groups[@]}"; do
385371
386372 pushd " ${group} "
387373 if [ " ${ENV} " = " pip" ]; then
374+ echo " Testing with pip environment: ${group} "
388375 if [ " ${WITH_SPCS_IMAGE} " = true ]; then
389376 COMMON_PYTEST_FLAG+=(-m " spcs_deployment_image and not pip_incompatible" )
390377 else
@@ -414,6 +401,7 @@ for i in "${!groups[@]}"; do
414401 python -m pip list
415402
416403 # Run the tests
404+ echo " Running tests with pytest flags: ${COMMON_PYTEST_FLAG[*]} "
417405 set +e
418406 TEST_SRCDIR=" ${TEMP_TEST_DIR} " python -m pytest " ${COMMON_PYTEST_FLAG[@]} " tests/integ/
419407 group_exit_codes[$i ]=$?
@@ -447,6 +435,7 @@ for i in "${!groups[@]}"; do
447435 " ${_MICROMAMBA_BIN} " list -p ./testenv
448436
449437 # Run integration tests
438+ echo " Running tests with pytest flags: ${COMMON_PYTEST_FLAG[*]} "
450439 set +e
451440 TEST_SRCDIR=" ${TEMP_TEST_DIR} " ${CONDA} run -p ./testenv --no-capture-output python -m pytest " ${COMMON_PYTEST_FLAG[@]} " tests/integ/
452441 group_exit_codes[$i ]=$?
510499
511500# Check all group exit codes
512501for exit_code in " ${group_exit_codes[@]} " ; do
513- if [[ (${MODE} = " merge_gate" || ${MODE} = " quarantined" || ${WITH_SPCS_IMAGE} = " true" ) && ${exit_code} -eq 5 ]]; then
502+ # Allow exit code 5 (no tests found) for all modes, as this is expected
503+ # when an optional dependency group has no tests
504+ if [[ ${exit_code} -eq 5 ]]; then
514505 continue
515506 fi
516507 if [[ ${exit_code} -ne 0 ]]; then
0 commit comments