Я хотел бы отслеживать функции, вызванные тестовыми случаями Pytest. В качестве примера я использую этот тестовый файл в Xarray. Я использую следующую команду для отслеживания < /p>
python -m trace --trackcalls --module pytest -rA xarray/tests/test_coding.py -n 64
< /code>
В выводе, который я могу увидеть, успешно выполняются тестовые примеры. < /p>
============================= test session starts ==============================
platform linux -- Python 3.10.16, pytest-8.3.4, pluggy-1.5.0
rootdir: /.../xarray
configfile: pyproject.toml
plugins: timeout-2.3.1, cov-6.0.0, metadata-3.1.1, env-1.1.5, json-0.4.0, hypothesis-6.125.1, xdist-3.6.1, json-report-1.5.0
created: 64/64 workers
64 workers [31 items]
............................... [100%]
==================================== PASSES ====================================
=========================== short test summary info ============================
PASSED xarray/tests/test_coding.py::test_coder_roundtrip
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-i1]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-u2]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-u1]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-f2]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_encode_missing_fill_values_conflict[numeric-without-dtype]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-f2]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_missing_value
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-f4]
PASSED xarray/tests/test_coding.py::test_scaling_offset_as_list[0.1-scale_factor1]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-u1]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-f4]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-i1]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_decode
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-i2]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_encode_missing_fill_values_conflict[numeric-with-dtype]
PASSED xarray/tests/test_coding.py::test_scaling_offset_as_list[0.1-10]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f8-u2]
PASSED xarray/tests/test_coding.py::test_scaling_converts_to_float[f4-i2]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_encode_missing_fill_values_conflict[times-with-dtype]
PASSED xarray/tests/test_coding.py::test_scaling_offset_as_list[add_offset1-10]
PASSED xarray/tests/test_coding.py::test_scaling_offset_as_list[add_offset1-scale_factor1]
PASSED xarray/tests/test_coding.py::test_decode_unsigned_from_signed[1]
PASSED xarray/tests/test_coding.py::test_decode_unsigned_from_signed[2]
PASSED xarray/tests/test_coding.py::test_decode_signed_from_unsigned[2]
PASSED xarray/tests/test_coding.py::test_decode_unsigned_from_signed[4]
PASSED xarray/tests/test_coding.py::test_decode_unsigned_from_signed[8]
PASSED xarray/tests/test_coding.py::test_decode_signed_from_unsigned[1]
PASSED xarray/tests/test_coding.py::test_decode_signed_from_unsigned[8]
PASSED xarray/tests/test_coding.py::test_decode_signed_from_unsigned[4]
PASSED xarray/tests/test_coding.py::test_CFMaskCoder_decode_dask
======================== 31 passed in 113.20s (0:01:53) ========================
calling relationships:
...
< /code>
Но в следующих отношениях вызовов ни один из методов испытаний и методы, которые должны быть вызваны. Я хотел бы знать, почему и как решить эту проблему. Спасибо.
Подробнее здесь: https://stackoverflow.com/questions/794 ... ing-pytest
Модуль трассировки Python не отображает отношения вызовов при запуске Pytest ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение