Skip to content

Commit 5b9ae5c

Browse files
committed
When checking skips skipping tests with no skip in them + updated documentation + quieted grep
1 parent fdb476d commit 5b9ae5c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

scripts/update_tests.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,24 @@ This updater is not meant to be used as a standalone updater. Care needs to be t
1111
Options:
1212
-c/--cpython-path <path> Path to the CPython source tree (older version)
1313
-r/--rpython-path <path> Path to the RustPython source tree (newer version)
14-
-u/--copy-untracked Copy untracked tests only
1514
-s/--update-skipped Update existing skipped tests (must be run separate from updating the tests)
16-
-t/--timeout Set a timeout for a test
1715
-a/--annotate While copying tests, run them and annotate failures dynamically
16+
-u/--copy-untracked Copy untracked tests
17+
-t/--timeout Set a timeout for a test
1818
-j/--jobs How many libraries can be processed at a time
1919
-h/--help Show this help message and exit
2020
2121
Example Usage:
22-
$0 -c ~/cpython -r .
23-
$0 -r . --check-skipped
22+
$0 -c ~/cpython -r - . -t 300 # Updates all non-updated tests with a timeout value of 300 seconds
23+
$0 -c ~/cpython -r . -u -j 5 # Updates all non-updated tests + copies files not in cpython into rpython, with maximum 5 processes active at a time
24+
$0 -c ~/cpython -r . -a # Updates all non-updated tests + annotates with @unittest.expectedFailure/@unittest.skip
25+
$0 -r . -s # For all current tests, check if @unittest.skip can be downgraded to @unittest.expectedFailure
2426
2527
*Notes:
2628
* When using the update skip functionality
2729
* Updating only looks for files with the format "test_*.py". Everything else (including __init__.py and __main__.py files are ignored)
2830
**Known limitations:
2931
* In multithreaded tests, if the tests are orphaned, then the updater can deadlock, as threads can accumulate and block the semaphore
30-
* In multithreaded tests, when annotating, multiple decorators can accumulate on one test
3132
* The updater does not add skips to classes, only on tests
3233
* If there are multiple tests with the same name, a decorator will be added to all of them
3334
* The updater does not retain anything more specific than a general skip (skipIf/Unless will be replaced by a general skip)
@@ -138,8 +139,12 @@ check_skips() {
138139
local libraries=("$@")
139140
for lib in "${libraries[@]}"
140141
do
141-
sem
142-
check_skip "$lib" &
142+
if grep -qiE "@unittest.skip.*\('TODO:\s*RUSTPYTHON.*'\)" "$rpython_path/$lib"; then
143+
sem
144+
check_skip "$lib" &
145+
else
146+
echo "Skipping $lib" >&2
147+
fi
143148
done
144149
wait
145150
}
@@ -213,7 +218,7 @@ replace_expected_with_skip() {
213218
already_failed() {
214219
file=$1
215220
test_name=$2
216-
grep -Pz "\s*@unittest\.expectedFailure # TODO: RUSTPYTHON\n\s*def\s+${test_name}\(" $file
221+
grep -qPz "\s*@unittest\.expectedFailure # TODO: RUSTPYTHON\n\s*def\s+${test_name}\(" $file
217222
}
218223

219224
files_equal() {

0 commit comments

Comments
 (0)