Skip to content

Commit 18b90ea

Browse files
authored
Fix socket warning in tests (#240)
1 parent 7dc6389 commit 18b90ea

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

scripts/pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ python = "3.11"
4747
[tool.hatch.envs.test]
4848
features = ["test"]
4949
[tool.hatch.envs.test.scripts]
50-
test = "pytest"
50+
run = "pytest -v {args}"
5151

5252
[tool.pytest.ini_options]
5353
addopts = [
@@ -59,11 +59,9 @@ addopts = [
5959
filterwarnings = ["error"]
6060

6161
[tool.black]
62-
target-version = ["py310"] # py311 not supported yet
6362
line-length = 120
6463

6564
[tool.ruff]
66-
target-version = "py311"
6765
line-length = 120
6866
allowed-confusables = ["", "×"]
6967
select = [

scripts/tests/test_cruft.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
from dataclasses import dataclass
33
from typing import cast
4+
from warnings import catch_warnings, filterwarnings
45

56
import pytest
67
from git import Commit, Diff
@@ -28,8 +29,11 @@ class MockRelease:
2829
@pytest.fixture
2930
def con(response_mock) -> GitHubConnection:
3031
resp = json.dumps({"login": "scverse-bot"})
31-
with response_mock(f"GET https://api.github.com:443/users/scverse-bot -> 200 :{resp}"):
32-
return GitHubConnection("scverse-bot")
32+
with catch_warnings():
33+
# https://github.com/idlesign/pytest-responsemock/issues/7
34+
filterwarnings("ignore", category=ResourceWarning)
35+
with response_mock(f"GET https://api.github.com:443/users/scverse-bot -> 200 :{resp}"):
36+
return GitHubConnection("scverse-bot")
3337

3438

3539
@pytest.fixture

0 commit comments

Comments
 (0)