- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
Test Impact Analysis is only supported in the following versions and testing frameworks:
pytest>=7.2.0
ddtrace>=2.1.0
.Python>=3.7
.coverage>=5.5
.pytest-cov
(see known limitations)unittest
ddtrace>=2.2.0
.Python>=3.7
.coverage
Prior to setting up Test Impact Analysis, set up Test Optimization for Python. If you are reporting data through the Agent, use v6.40 and later or v7.40 and later.
Intelligent Test Runner Activation (intelligent_test_runner_activation_write
) 권한이 있는 조직의 사용자는 Test Service Settings 페이지에서 Intelligent Test Runner를 활성화해야 합니다.
Test Impact Analysis requires the coverage
package.
Install the package in your CI test environment by specifying it in the relevant requirements file, for example, or using pip
:
pip install coverage
See known limitations if you are already using the coverage
package or a plugin like pytest-cov
.
Test Impact Analysis is enabled when you run tests with the Datadog integration active. Run your tests with the following command:
DD_ENV=ci DD_SERVICE=my-python-app pytest --ddtrace
DD_ENV=ci DD_SERVICE=my-python-app ddtrace-run python -m unittest
Test Impact Analysis can be disabled locally by setting the DD_CIVISIBILITY_ITR_ENABLED
environment variable to false
or 0
.
DD_CIVISIBILITY_ITR_ENABLED
(Optional)(true)
Run the following command to disable Test Impact Analysis:
DD_ENV=ci DD_SERVICE=my-python-app DD_CIVISIBILITY_ITR_ENABLED=false pytest --ddtrace
DD_ENV=ci DD_SERVICE=my-python-app DD_CIVISIBILITY_ITR_ENABLED=false ddtrace-run python -m unittest
You can override Test Impact Analysis’s behavior and prevent specific tests from being skipped. These tests are referred to as unskippable tests.
Test Impact Analysis uses code coverage data to determine whether or not tests should be skipped. In some cases, this data may not be sufficient to make this determination.
Examples include:
Designating tests as unskippable ensures that Test Impact Analysis runs them regardless of coverage data.
Unskippable tests are supported in the following versions:
pytest
ddtrace>=1.19.0
.You can use pytest
’s skipif
mark to prevent Test Impact Analysis from skipping individual tests or modules. Specify the condition
as False
, and the reason
as "datadog_itr_unskippable"
.
Individual tests can be marked as unskippable using the @pytest.mark.skipif
decorator as follows:
import pytest
@pytest.mark.skipif(False, reason="datadog_itr_unskippable")
def test_function():
assert True
Modules can be skipped using the pytestmark
global variable as follows:
import pytest
pytestmark = pytest.mark.skipif(False, reason="datadog_itr_unskippable")
def test_function():
assert True
Note: This does not override any other skip
marks, or skipif
marks that have a condition
evaluating to True
.
Unskippable tests are supported in the following versions:
unittest
ddtrace>=2.2.0
.unittest
You can use unittest
’s skipif
mark to prevent Test Impact Analysis from skipping individual tests. Specify the condition
as False
, and the reason
as "datadog_itr_unskippable"
.
Individual tests can be marked as unskippable using the @unittest.skipif
decorator as follows:
import unittest
class MyTestCase(unittest.TestCase):
@unittest.skipIf(False, reason="datadog_itr_unskippable")
def test_function(self):
assert True
Using @unittest.skipif
does not override any other skip
marks, or skipIf
marks that have a condition
evaluating to True
.
Coverage data may appear incomplete when Test Impact Analysis is enabled. Lines of code that would normally be covered by tests are not be covered when these tests are skipped.
Test Impact Analysis uses the coverage
package’s API to collect code coverage. Data from coverage run
or plugins like pytest-cov
is incomplete as a result of ddtrace
’s use of the Coverage
class.
Some race conditions may cause exceptions when using pytest
plugins such as pytest-xdist
that change test execution order or introduce parallelization.