Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit50abf3d

Browse files
authored
Clean up warning filters in tests (#2714)
* Clean up warning filters in tests* Ignore some more warnings* Ignore some more warnings* Ignore boto3 deprecation warning* Ignore unclosed client warning* Filter another fsspec warning* Ignore zip warning* Filter warning in test_stateful* pre-commit fixes* Filter warning in test_wrapper* Filter warning in memorystore* Close pool in multiprocessing test* pre-commit fixes* Filter two more warnings* Filter another warning* Filter more warnings* Add changelog* Ignore unclosed client sessions* Put back dtype filter* Make client session filter better
1 parent3b6565b commit50abf3d

File tree

9 files changed

+59
-10
lines changed

9 files changed

+59
-10
lines changed

‎changes/2714.misc.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make warning filters in the tests more specific, so warnings emitted by tests added in the future are more likely to be caught instead of ignored.

‎pyproject.toml‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,18 @@ addopts = [
397397
"--durations=10","-ra","--strict-config","--strict-markers",
398398
]
399399
filterwarnings = [
400-
"error:::zarr.*",
401-
"ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning",
402-
"ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning",
403-
"ignore:Creating a zarr.buffer.gpu.*:UserWarning",
404-
"ignore:Duplicate name:UserWarning",# from ZipFile
405-
"ignore:.*is currently not part in the Zarr format 3 specification.*:UserWarning",
400+
"error",
401+
# TODO: explicitly filter or catch the warnings below where we expect them to be emitted in the tests
402+
"ignore:Consolidated metadata is currently not part in the Zarr format 3 specification.*:UserWarning",
403+
"ignore:Creating a zarr.buffer.gpu.Buffer with an array that does not support the __cuda_array_interface__.*:UserWarning",
404+
"ignore:Automatic shard shape inference is experimental and may change without notice.*:UserWarning",
405+
"ignore:The codec .* is currently not part in the Zarr format 3 specification.*:UserWarning",
406+
"ignore:The dtype .* is currently not part in the Zarr format 3 specification.*:UserWarning",
407+
"ignore:Use zarr.create_array instead.:DeprecationWarning",
408+
"ignore:Duplicate name.*:UserWarning",
409+
"ignore:The `compressor` argument is deprecated. Use `compressors` instead.:UserWarning",
410+
"ignore:Numcodecs codecs are not in the Zarr version 3 specification and may not be supported by other zarr implementations.:UserWarning",
411+
"ignore:Unclosed client session <aiohttp.client.ClientSession.*:ResourceWarning"
406412
]
407413
markers = [
408414
"gpu: mark a test as requiring CuPy and GPU",

‎tests/test_array.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,9 +1417,8 @@ def test_multiprocessing(store: Store, method: Literal["fork", "spawn", "forkser
14171417
data=np.arange(100)
14181418
arr=zarr.create_array(store=store,data=data)
14191419
ctx=mp.get_context(method)
1420-
pool=ctx.Pool()
1421-
1422-
results=pool.starmap(_index_array, [(arr,slice(len(data)))])
1420+
withctx.Pool()aspool:
1421+
results=pool.starmap(_index_array, [(arr,slice(len(data)))])
14231422
assertall(np.array_equal(r,data)forrinresults)
14241423

14251424

‎tests/test_store/test_fsspec.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
importjson
44
importos
5+
importre
56
fromtypingimportTYPE_CHECKING
67

78
importpytest
@@ -19,6 +20,17 @@
1920

2021
importbotocore.client
2122

23+
# Warning filter due to https://github.com/boto/boto3/issues/3889
24+
pytestmark= [
25+
pytest.mark.filterwarnings(
26+
re.escape("ignore:datetime.datetime.utcnow() is deprecated:DeprecationWarning")
27+
),
28+
# TODO: fix these warnings
29+
pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning"),
30+
pytest.mark.filterwarnings(
31+
"ignore:coroutine 'ClientCreatorContext.__aexit__' was never awaited:RuntimeWarning"
32+
),
33+
]
2234

2335
fsspec=pytest.importorskip("fsspec")
2436
s3fs=pytest.importorskip("s3fs")

‎tests/test_store/test_memory.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__importannotations
22

3+
importre
34
fromtypingimportTYPE_CHECKING
45

56
importnumpyasnp
@@ -15,6 +16,10 @@
1516
fromzarr.core.commonimportZarrFormat
1617

1718

19+
# TODO: work out where this warning is coming from and fix it
20+
@pytest.mark.filterwarnings(
21+
re.escape("ignore:coroutine 'ClientCreatorContext.__aexit__' was never awaited")
22+
)
1823
classTestMemoryStore(StoreTests[MemoryStore,cpu.Buffer]):
1924
store_cls=MemoryStore
2025
buffer_cls=cpu.Buffer
@@ -73,6 +78,8 @@ async def test_deterministic_size(
7378
np.testing.assert_array_equal(a[3:],0)
7479

7580

81+
# TODO: fix this warning
82+
@pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning")
7683
@gpu_test
7784
classTestGpuMemoryStore(StoreTests[GpuMemoryStore,gpu.Buffer]):
7885
store_cls=GpuMemoryStore

‎tests/test_store/test_stateful.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
fromzarr.storageimportLocalStore,ZipStore
99
fromzarr.testing.statefulimportZarrHierarchyStateMachine,ZarrStoreStateMachine
1010

11-
pytestmark=pytest.mark.slow_hypothesis
11+
pytestmark= [
12+
pytest.mark.slow_hypothesis,
13+
# TODO: work out where this warning is coming from and fix
14+
pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning"),
15+
]
1216

1317

1418
deftest_zarr_hierarchy(sync_store:Store):

‎tests/test_store/test_wrapper.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
fromzarr.core.buffer.coreimportBufferPrototype
1616

1717

18+
# TODO: fix this warning
19+
@pytest.mark.filterwarnings(
20+
"ignore:coroutine 'ClientCreatorContext.__aexit__' was never awaited:RuntimeWarning"
21+
)
1822
classTestWrapperStore(StoreTests[WrapperStore,Buffer]):
1923
store_cls=WrapperStore
2024
buffer_cls=Buffer
@@ -72,6 +76,10 @@ def test_is_open_setter_raises(self, store: WrapperStore) -> None:
7276
store._is_open=True
7377

7478

79+
# TODO: work out where warning is coming from and fix
80+
@pytest.mark.filterwarnings(
81+
"ignore:coroutine 'ClientCreatorContext.__aexit__' was never awaited:RuntimeWarning"
82+
)
7583
@pytest.mark.parametrize("store", ["local","memory","zip"],indirect=True)
7684
asyncdeftest_wrapped_set(store:Store,capsys:pytest.CaptureFixture[str])->None:
7785
# define a class that prints when it sets
@@ -89,6 +97,7 @@ async def set(self, key: str, value: Buffer) -> None:
8997
assertawaitstore_wrapped.get(key,buffer_prototype)==value
9098

9199

100+
@pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning")
92101
@pytest.mark.parametrize("store", ["local","memory","zip"],indirect=True)
93102
asyncdeftest_wrapped_get(store:Store,capsys:pytest.CaptureFixture[str])->None:
94103
# define a class that prints when it sets

‎tests/test_store/test_zip.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
fromtypingimportAny
2020

2121

22+
# TODO: work out where this is coming from and fix
23+
pytestmark= [
24+
pytest.mark.filterwarnings(
25+
"ignore:coroutine method 'aclose' of 'ZipStore.list' was never awaited:RuntimeWarning"
26+
)
27+
]
28+
29+
2230
classTestZipStore(StoreTests[ZipStore,cpu.Buffer]):
2331
store_cls=ZipStore
2432
buffer_cls=cpu.Buffer
@@ -66,6 +74,8 @@ def test_store_supports_partial_writes(self, store: ZipStore) -> None:
6674
deftest_store_supports_listing(self,store:ZipStore)->None:
6775
assertstore.supports_listing
6876

77+
# TODO: fix this warning
78+
@pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning")
6979
deftest_api_integration(self,store:ZipStore)->None:
7080
root=zarr.open_group(store=store,mode="a")
7181

‎tests/test_sync.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def test_sync_raises_if_loop_is_closed() -> None:
9090
foo.assert_not_awaited()
9191

9292

93+
@pytest.mark.filterwarnings("ignore:Unclosed client session:ResourceWarning")
9394
@pytest.mark.filterwarnings("ignore:coroutine.*was never awaited")
9495
deftest_sync_raises_if_calling_sync_from_within_a_running_loop(
9596
sync_loop:asyncio.AbstractEventLoop|None,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp