Skip to content

Commit 21d61e0

Browse files
committed
grep pytest output
1 parent 56fdb9d commit 21d61e0

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,20 @@ jobs:
161161
py.test -vv tests/*_test.py tests/test_*.py -m "not strict_endpoints_test"
162162
- name: Check availability of analyses endpoints
163163
env:
164-
COVERAGE_FILE: '.coverage_func'
165164
SQLALCHEMY_WARN_20: 1
166165
continue-on-error: true
167166
run: |
168-
py.test -vv tests/*_test.py tests/test_*.py -m "strict_endpoints_test" || echo "::warning ::At least one analyses endpoint was not available"
167+
EXTRA_MSG=""
168+
RESULT=$(pytest --color=yes -vv tests/*_test.py tests/test_*.py -m "strict_endpoints_test")
169+
if [ $? -ne 0 ]; then # if test failed
170+
while read -r FAIL; do
171+
ANALYSIS=`echo ${FAIL##*strict\[} | cut -d "]" -f1` # get analysis name from pattern "strict[<ANALYSIS>]"
172+
REASON=`echo ${FAIL#* - }` # get fail reason after " -"
173+
EXTRA_MSG="$EXTRA_MSG::warning ::Analyses endpoint '$ANALYSIS' was not available: $REASON\n"
174+
done <<< `echo $RESULT | grep "FAILED.*\[" | grep -v "%"` # get summary lines with failing tests, ignore progress lines
175+
fi
176+
echo "$RESULT"
177+
echo -n $EXTRA_MSG # flag warning to GitHub, remove trailing new lines
169178
- name: Setup Sauce Connect
170179
uses: saucelabs/sauce-connect-action@v3.0.0
171180
if: startsWith(matrix.python-version, '3.9')

tests/records_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ def test_update_analyses(app, tool, import_id, counts, test_user, url, license):
10821082
assert is_current_user_subscribed_to_record(submission.publication_recid, user)
10831083

10841084

1085-
testdata_analyses_pytest_strict = list(testdata_analyses.keys())+["TestAnalysis"]
1085+
testdata_analyses_pytest_strict = list(testdata_analyses.keys())+["TestAnalysis", "TestAnalysis2"]
10861086
@pytest.mark.strict_endpoints_test
10871087
@pytest.mark.parametrize("tool", testdata_analyses_pytest_strict)
10881088
def test_update_analyses_strict(app, tool):

0 commit comments

Comments
 (0)