Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Configure parallel tests with Django

Focus mode
Configure parallel tests with Django - AWS CodeBuild

The following is sample of a buildspec.yml that shows parallel test execution with Django on an Ubuntu platform:

version: 0.2 batch: fast-fail: false build-fanout: parallelism: 5 phases: install: commands: - echo 'Installing Python dependencies' - sudo yum install -y python3 python3-pip - python3 -m ensurepip --upgrade - python3 -m pip install django pre_build: commands: - echo 'Prebuild' build: commands: - echo 'Running Django Tests' - | codebuild-tests-run \ --test-command 'python3 manage.py test $(echo "$CODEBUILD_CURRENT_SHARD_FILES" | sed -E "s/\//__/g; s/\.py$//; s/__/./g")' \ --files-search "codebuild-glob-search '**/tests/*test_*.py'" \ --sharding-strategy 'equal-distribution' post_build: commands: - echo 'Test execution completed'

The above example shows the usage of the environment variable CODEBUILD_CURRENT_SHARD_FILES. Here CODEBUILD_CURRENT_SHARD_FILES is used to fetch dot notation file paths supported by Django. Use CODEBUILD_CURRENT_SHARD_FILES inside double quotes as shown above.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.