From 1a8b8ad9ced58382cd3db2677ebac3dc9ad3d2f2 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 3 May 2024 11:31:12 -0700 Subject: [PATCH] Try to address ResourceWarnings --- .../custreamz/tests/test_dataframes.py | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/python/custreamz/custreamz/tests/test_dataframes.py b/python/custreamz/custreamz/tests/test_dataframes.py index bae4b051cae..6de1c5cdd98 100644 --- a/python/custreamz/custreamz/tests/test_dataframes.py +++ b/python/custreamz/custreamz/tests/test_dataframes.py @@ -24,19 +24,23 @@ @pytest.fixture(scope="module") def client(): - client = Client(processes=False, asynchronous=False) - try: + with Client(processes=False, asynchronous=False) as client: yield client - finally: - client.close() -@pytest.fixture(params=["core", "dask"]) -def stream(request, client): - if request.param == "core": - return Stream() - else: - return DaskStream() +@pytest.fixture(scope="module") +def dask_stream(client): + return DaskStream() + + +@pytest.fixture +def core_stream(): + return Stream() + + +@pytest.fixture(params=["core_stream", "dask_stream"]) +def stream(request): + return request.getfixturevalue(request.param) def test_identity(stream):