Skip to content

Commit 0d14d8f

Browse files
author
Shubham Vasudeo Desai
committed
modify collect all testcases
1 parent 5021680 commit 0d14d8f

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

.github/workflows/macos.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,39 @@ jobs:
297297
export LD_LIBRARY_PATH
298298
299299
PR_DIR="pr_${PR_ID}"
300-
mkdir -p "artifacts/${PR_DIR}/macos"
300+
CURR_DIR="artifacts/${PR_DIR}/macos"
301+
mkdir -p "${CURR_DIR}"
302+
303+
COLLECT_JSON="${CURR_DIR}/collect.json"
304+
ALL_TESTS_FILE="${CURR_DIR}/all_tests.txt"
301305
306+
echo "Collecting test cases into JSON..."
302307
pytest \
303308
@.github/workflows/pytest_args_ci.txt \
304309
@.github/workflows/pytest_args_parallel.txt \
305-
--collect-only --quiet \
306-
-k 'not testsuite' \
307-
| grep "::" > "artifacts/${PR_DIR}/macos/all_tests.txt" || true
310+
--collect-only \
311+
--json-report --json-report-file="${COLLECT_JSON}" \
312+
-k 'not testsuite' || true
313+
314+
echo "Extracting nodeids from collect.json..."
315+
if [[ -f "${COLLECT_JSON}" ]]; then
316+
# pytest-json-report usually stores collected tests here
317+
jq -r '.collectors[].nodes[].nodeid // empty' "${COLLECT_JSON}" > "${ALL_TESTS_FILE}" || true
318+
else
319+
echo "WARNING: ${COLLECT_JSON} not found, writing empty all_tests.txt"
320+
: > "${ALL_TESTS_FILE}"
321+
fi
322+
323+
echo "===== DEBUG: all_tests.txt ====="
324+
if [[ -f "${ALL_TESTS_FILE}" ]]; then
325+
wc -l "${ALL_TESTS_FILE}" || true
326+
echo "Sample lines:"
327+
head -n 5 "${ALL_TESTS_FILE}" || true
328+
else
329+
echo "all_tests.txt not found"
330+
fi
331+
echo "================================"
332+
308333
309334
310335
- name: Debug all_tests count (macOS)

0 commit comments

Comments
 (0)