Skip to content

Commit

Permalink
Resolves resource warnings on unclosed sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Jan 10, 2025
1 parent aa0fa75 commit 05095a3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
15 changes: 3 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,19 @@ installer = "uv"

[tool.hatch.envs.hatch-static-analysis]
# https://hatch.pypa.io/latest/config/internal/static-analysis/
dependencies = [ "ruff ~= 0.8" ]
dependencies = [ "ruff ~= 0.9" ]
config-path = "none"

[tool.hatch.envs.hatch-test]
# https://hatch.pypa.io/latest/config/internal/testing/
parallel = true
randomize = true
dependencies = [
"coverage-enable-subprocess == 1.0",
"coverage[toml] ~= 7.6",
"pytest ~= 8.3",
"pytest-mock ~= 3.14",
"pytest-randomly ~= 3.15",
"pytest-rerunfailures ~= 15.0",
"pytest-xdist[psutil] ~= 3.6",
"pytest-asyncio ~= 0.25",
]
extra-dependencies = [
"pytest-sugar",
"pytest-httpx ~= 0.33",
"python-magic",
"pytest-docker ~= 3.1",
"pytest-asyncio ~= 0.25",
]
extra-args = [ "--maxprocesses=8", "--pythonwarnings=all" ]

Expand Down Expand Up @@ -245,7 +236,7 @@ max_supported_python = "3.13"
minversion = "8.0"
testpaths = [ "tests" ]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "session"
asyncio_default_fixture_loop_scope = "function"

[tool.coverage.run]
source_pkgs = [ "tika_client", "tests" ]
Expand Down
11 changes: 7 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
from collections.abc import AsyncGenerator
from collections.abc import Generator
from pathlib import Path

Expand Down Expand Up @@ -112,10 +113,12 @@ def tika_client_compressed(tika_host: str) -> Generator[TikaClient, None, None]:


@pytest.fixture
async def async_tika_client(tika_host: str) -> AsyncTikaClient:
return AsyncTikaClient(tika_url=tika_host, log_level=logging.INFO)
async def async_tika_client(tika_host: str) -> AsyncGenerator[AsyncTikaClient, None]:
async with AsyncTikaClient(tika_url=tika_host, log_level=logging.INFO) as client:
yield client


@pytest.fixture
async def async_tika_client_compressed(tika_host: str) -> AsyncTikaClient:
return AsyncTikaClient(tika_url=tika_host, log_level=logging.INFO, compress=True)
async def async_tika_client_compressed(tika_host: str) -> AsyncGenerator[AsyncTikaClient, None]:
async with AsyncTikaClient(tika_url=tika_host, log_level=logging.INFO, compress=True) as client:
yield client

0 comments on commit 05095a3

Please sign in to comment.