elastic / elastic/apm-agent-python
use unittest.mock instead of mock in tests
- Lingua principale
- Python
- Stelle
- 431
- Fork
- 239
- Merge medio
- 5g 10h
- PR unite (30g)
- 7
Descrizione
**Describe the bug**:
with 7241b27ba9f190167c70abc728f629061396d0fb your use unittest.mock instead of mock,
why this wasn't implemented consistently?
Could you please also adjust the tests?
**To Reproduce**
12:47 $ grep mock -r | grep import
tests/client/py3_exception_tests.py:import mock
tests/client/client_tests.py:import mock
tests/client/exception_tests.py:import mock
tests/events/tests.py:from mock import Mock
tests/config/central_config_tests.py:import mock
tests/config/tests.py:import mock
tests/contrib/django/wrapper_tests.py:import mock
tests/contrib/django/django_tests.py:import mock
tests/contrib/opentracing/tests.py:import mock
tests/contrib/flask/flask_tests.py:import mock
tests/contrib/celery/flask_tests.py:import mock
tests/contrib/serverless/azurefunctions/azure_functions_tests.py:import mock
tests/contrib/asyncio/starlette_tests.py:import mock
tests/contrib/asyncio/aiohttp_web_tests.py:import mock
tests/contrib/asyncio/tornado/tornado_tests.py:import mock
tests/transports/test_urllib3.py:import mock
tests/transports/test_base.py:import mock
tests/processors/tests.py:import mock
tests/fixtures.py:import mock
tests/metrics/base_tests.py:import mock
tests/metrics/breakdown_tests.py:import mock
tests/instrumentation/transactions_store_tests.py:import mock
tests/instrumentation/elasticsearch_tests.py:from unittest import mock
tests/instrumentation/base_tests.py:import mock
tests/instrumentation/urllib_tests.py:import mock
tests/utils/threading_tests.py:import mock
tests/utils/compat_tests.py:import mock
tests/utils/cloud_tests.py:import mock
tests/utils/stacks/tests.py:from mock import Mock
**Environment (please complete the following information)**
- OS: Debian sid
- Python version: 3.13, 3.14
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Usa l’output di grep dell’issue come elenco dei file, iniziando da tests/client/py3_exception_tests.py e tests/fixtures.py, e verifica l’import esistente di unittest.mock in tests/instrumentation/elasticsearch_tests.py per individuare lo stile previsto. Sostituisci gli import rimanenti di mock nei test elencati, quindi esegui nuovamente la suite di test o i file di test interessati; il lavoro è completato quando nessun test elencato importa più il pacchetto mock standalone.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- python
- Ambito
- testing
- Tipo di issue
- Refactoring
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Tranquilla
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 55/100