Skip to content

Commit d324162

Browse files
authored
test: resolve deprecation warnings (#413)
unpin pytest-asyncio
1 parent 7ab4119 commit d324162

File tree

3 files changed

+9
-16
lines changed

3 files changed

+9
-16
lines changed

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ dev = [
4646
"psycopg2-binary",
4747
"ruff==0.12.1",
4848
]
49-
tests = ["pytest", "pytest-cov", "pytest-asyncio==0.18.3", "mock"]
49+
tests = ["pytest", "pytest-cov", "pytest-asyncio", "mock"]
5050
docs = [
5151
"sphinx==6.1.3",
5252
"sphinx-autodoc-typehints==1.22.0",
@@ -81,6 +81,9 @@ build-backend = "setuptools.build_meta"
8181
"cool_seq_tool.resources" = ["transcript_mapping.tsv"]
8282

8383
[tool.pytest.ini_options]
84+
asyncio_mode = "auto"
85+
asyncio_default_fixture_loop_scope = "session"
86+
asyncio_default_test_loop_scope = "session"
8487
addopts = "--cov=src --cov-report term-missing"
8588
testpaths = ["tests"]
8689

tests/conftest.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Provide utilities for test cases."""
22

3-
import asyncio
4-
53
import pytest
64

75
from cool_seq_tool import CoolSeqTool
@@ -10,14 +8,6 @@
108
from cool_seq_tool.sources.uta_database import GenomicAlnData, GenomicTxMetadata
119

1210

13-
@pytest.fixture(scope="session")
14-
def event_loop(request):
15-
"""Create an instance of the default event loop for each test case."""
16-
loop = asyncio.get_event_loop_policy().new_event_loop()
17-
yield loop
18-
loop.close()
19-
20-
2111
@pytest.fixture(scope="session")
2212
def test_cool_seq_tool():
2313
"""Create CoolSeqTool test fixture"""

tests/mappers/test_mane_transcript.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ async def test_g_to_c(
298298

299299
def test_set_liftover(test_mane_transcript, genomic_tx_data):
300300
"""Test that _set_liftover works correctly."""
301-
cpy = genomic_tx_data.copy(deep=True)
302-
expected = genomic_tx_data.copy(deep=True)
301+
cpy = genomic_tx_data.model_copy(deep=True)
302+
expected = genomic_tx_data.model_copy(deep=True)
303303
test_mane_transcript._set_liftover(cpy, "alt_pos_range", "chr7", "GRCh38")
304304
expected.alt_pos_range = (140739811, 140739946)
305305
assert cpy == expected
@@ -311,8 +311,8 @@ def test_set_liftover(test_mane_transcript, genomic_tx_data):
311311
@pytest.mark.asyncio
312312
async def test_liftover_to_38(test_mane_transcript, genomic_tx_data):
313313
"""Test that liftover_to_38 works correctly."""
314-
cpy = genomic_tx_data.copy(deep=True)
315-
expected = genomic_tx_data.copy(deep=True)
314+
cpy = genomic_tx_data.model_copy(deep=True)
315+
expected = genomic_tx_data.model_copy(deep=True)
316316
await test_mane_transcript._liftover_to_38(cpy)
317317
expected.alt_ac = "NC_000007.14"
318318
expected.alt_pos_change_range = (140739903, 140739903)
@@ -675,7 +675,7 @@ async def test_g_to_grch38(test_mane_transcript, grch38_egfr, grch38_braf):
675675
resp = await test_mane_transcript.g_to_grch38(
676676
"NC_000007.13", 55259515, 55259515, get_mane_genes=False
677677
)
678-
grch38_egfr_no_genes = grch38_egfr.copy()
678+
grch38_egfr_no_genes = grch38_egfr.model_copy()
679679
grch38_egfr_no_genes.mane_genes = []
680680
assert resp == grch38_egfr_no_genes
681681

0 commit comments

Comments
 (0)