Skip to content

Commit cac9971

Browse files
committed
Fix PT022 pytest-useless-yield-fixture
1 parent 9f36aeb commit cac9971

File tree

12 files changed

+11
-13
lines changed

12 files changed

+11
-13
lines changed

tests/agent_unittests/test_package_version_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def patched_pytest_module(monkeypatch):
4747
if hasattr(pytest, attr):
4848
monkeypatch.delattr(pytest, attr)
4949

50-
yield pytest
50+
return pytest
5151

5252

5353
@pytest.fixture(autouse=True)

tests/agent_unittests/test_sampler_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def cpu_data_source():
4646
@pytest.fixture
4747
def memory_data_source():
4848
sampler = memory_usage_data_source(settings=())["factory"](environ=())
49-
yield sampler
49+
return sampler
5050

5151

5252
PID = os.getpid()

tests/application_celery/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def celery_worker_parameters():
4242

4343
@pytest.fixture(scope="session", autouse=True)
4444
def celery_worker_available(celery_session_worker):
45-
yield celery_session_worker
45+
return celery_session_worker

tests/datastore_cassandradriver/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def cluster_options(connection_class):
7777
"connection_class": connection_class,
7878
"protocol_version": 4,
7979
}
80-
yield cluster_options
80+
return cluster_options
8181

8282

8383
@pytest.fixture
8484
def cluster(cluster_options):
8585
from cassandra.cluster import Cluster
8686

8787
cluster = Cluster(**cluster_options)
88-
yield cluster
88+
return cluster

tests/datastore_firestore/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def async_client(loop):
8484
@pytest.fixture
8585
def async_collection(async_client, collection):
8686
# Use the same collection name as the collection fixture
87-
yield async_client.collection(collection.id)
87+
return async_client.collection(collection.id)
8888

8989

9090
@pytest.fixture(scope="session")

tests/datastore_firestore/test_async_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ async def _mock_partition_query():
172172
return _mock_partition_query()
173173

174174
monkeypatch.setattr(async_client._firestore_api, "partition_query", mock_partition_query)
175-
yield
176175

177176

178177
@pytest.fixture

tests/datastore_firestore/test_query.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ def mock_partition_query(*args, **kwargs):
165165
yield Cursor(before=False, values=[Value(reference_value=documents[0].path)])
166166

167167
monkeypatch.setattr(client._firestore_api, "partition_query", mock_partition_query)
168-
yield
169168

170169

171170
@pytest.fixture

tests/external_httpx/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class RealHTTP2Server:
4646
host = settings["host"]
4747
port = settings["port"]
4848

49-
yield RealHTTP2Server
49+
return RealHTTP2Server
5050

5151

5252
@pytest.fixture

tests/logger_structlog/test_processor_formatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def emit(self, record):
7373

7474
structlog_logger = structlog.get_logger(logger_attr=2)
7575

76-
yield logging_logger, structlog_logger
76+
return logging_logger, structlog_logger
7777

7878

7979
@pytest.fixture

tests/messagebroker_kombu/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def producer(producer_connection, queue):
7777

7878
producer = producer_connection.Producer(serializer="json")
7979

80-
yield producer
80+
return producer
8181

8282

8383
@pytest.fixture

0 commit comments

Comments
 (0)