Skip to content

Commit

Permalink
ci: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bolinocroustibat committed Dec 21, 2024
1 parent 4e7cab2 commit 7edd80a
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ jobs:
- image: udata/circleci:py3.11
- image: mongo:6.0.4
- image: redis:alpine
environment:
BASH_ENV: /root/.bashrc
parallelism: 2
steps:
- checkout
Expand Down Expand Up @@ -58,32 +56,25 @@ jobs:
mkdir -p reports/python
source venv/bin/activate
# List of longer-running tests to execute in parallel
# List of longer-running tests to execute in parallel (using pytest module notation)
PARALLEL_TESTS=(
"udata/harvest/tests/test_actions.py"
"udata/tests/api/test_activities_api.py"
"udata/tests/api/test_datasets_api.py"
"udata/tests/api/test_organizations_api.py"
"udata/tests/api/test_reports_api.py"
"udata/tests/apiv2/test_swagger.py"
"udata/tests/api/test_transfer_api.py"
"udata/tests/forms/test_form_field.py"
"udata.harvest.tests.test_actions"
"udata.tests.api.test_activities_api"
"udata.tests.api.test_datasets_api"
"udata.tests.api.test_organizations_api"
"udata.tests.api.test_reports_api"
"udata.tests.apiv2.test_swagger"
"udata.tests.api.test_transfer_api"
"udata.tests.forms.test_form_field"
)
# Convert array to string with | as separator for grep
PARALLEL_PATTERN=$(printf "%s|" "${PARALLEL_TESTS[@]}" | sed 's/|$//')
if [ "$CIRCLE_NODE_INDEX" = "0" ]; then
echo "=== EXECUTOR 0: Running all tests except these parallel ones: ==="
printf '%s\n' "${PARALLEL_TESTS[@]}"
echo "=================================================="
# Run pytest to collect all tests, then filter out parallel ones
python -m pytest --collect-only -q | grep "\.py" | grep -vE "$PARALLEL_PATTERN" > serial_tests.txt
echo "Tests to run in serial:"
cat serial_tests.txt
inv test --report --ci
else
echo "=== EXECUTOR 1: Running parallel tests: ==="
echo "=== EXECUTOR 1: Running these parallel tests: ==="
printf '%s\n' "${PARALLEL_TESTS[@]}"
echo "=================================================="
inv test --report --ci --paths "${PARALLEL_TESTS[@]}"
Expand Down

0 comments on commit 7edd80a

Please sign in to comment.