[python] tox에서의 테스트 데이터 관리는 어떻게 이루어지나요?
가령, tox.ini 파일에 다음과 같이 테스트 환경을 설정할 수 있습니다:
[tox]
envlist = py37
[testenv]
deps = pytest
commands = pytest
이후에는 필요한 데이터를 예를 들어 tests/data
디렉토리에 저장하고, 테스트 코드에서는 이를 활용할 수 있습니다:
import os
def test_something():
test_data_path = os.path.join(os.path.dirname(__file__), 'data', 'test_data.txt')
# test_data_path를 이용해 데이터 활용
이를 통해 tox에서의 테스트 데이터 관리를 효과적으로 할 수 있습니다.