Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added conditioning for erroring tests + moved some logic into separat…
…e functions
  • Loading branch information
terryluan12 committed Jan 11, 2026
commit 0a2ea1b12ac79b745b169c98d52ae409a7691f1c
55 changes: 34 additions & 21 deletions scripts/update_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,37 @@ update_libraries() {

for lib in "${libraries[@]}"
do
cpython_file="$cpython_path/$lib"
rpython_file="$rpython_path/$lib"
update_library "$lib"
done
}

filename=${lib##*/}
basename=${filename%.py}
update_library() {
lib=$1
cpython_file="$cpython_path/$lib"
rpython_file="$rpython_path/$lib"

if files_equal "$cpython_file" "$rpython_file"; then
echo "No changes in $lib. Skipping..."
continue
fi
filename=${lib##*/}
basename=${filename%.py}

if [[ ! -f "$rpython_file" ]]; then
echo "Test file $lib missing."
if $copy_untracked; then
echo "Copying..."
cp "$cpython_file" "$rpython_file"
fi
else
./scripts/lib_updater.py --from $cpython_file --to $rpython_file -o $rpython_file
if files_equal "$cpython_file" "$rpython_file"; then
echo "No changes in $lib. Skipping..."
continue
fi

if [[ ! -f "$rpython_file" ]]; then
echo "Test file $lib missing."
if $copy_untracked; then
echo "Copying..."
cp "$cpython_file" "$rpython_file"
fi
else
./scripts/lib_updater.py --from $cpython_file --to $rpython_file -o $rpython_file
fi

if $annotate; then
output=$(cargo run --release --features encodings,sqlite -- -m test -j 1 -u all --slowest --fail-env-changed -v $lib 2>&1)

output=$(cargo run --release --features encodings,sqlite -- -m test -j 1 -u all --slowest --fail-env-changed -v $lib 2>&1)
if $annotate; then
while ! grep -q "Tests result: SUCCESS" <<< "$output"; do
failed_tests=$(echo "$output" | grep '^FAIL: ' | awk '{print $2}')
errored_tests=$(echo "$output" | grep '^ERROR ' | awk '{print $2}')
failed_tests=$(echo "$failed_tests" | sort -u)
Expand All @@ -101,10 +109,15 @@ update_libraries() {
do
sed -i "s/^\([[:space:]]*\)def $test(/\1@unittest.expectedFailure # TODO: RUSTPYTHON\n\1def $test(/" "$rpython_file"
done

if grep -q "\.\.\.$" <<< "$output"; then
hanging_test=$(echo "$output" | grep '\.\.\.$' | head -n 1 | awk '{print $1}')
sed -i "s/^\([[:space:]]*\)def $hanging_test(/\1@unittest.skip('TODO: RUSTPYTHON')\n\1def $hanging_test(/" "$rpython_file"
fi

output=$(cargo run --release --features encodings,sqlite -- -m test -j 1 -u all --slowest --fail-env-changed -v $lib 2>&1)
echo "$failed_tests"
fi
done
done
fi
}


Expand Down