Skip to content

Commit 1e78fdf

Browse files
authored
Add extra ignore in pytest.ini to prevent occasional breaking for a DeprecationWarning (#20315)
* add extra ignore in pytest.ini * catch keyerror * pythonic representation * ruff import order
1 parent d8144a9 commit 1e78fdf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

chia/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from __future__ import annotations
22

3-
import importlib.metadata
43
import sys
4+
from importlib.metadata import PackageNotFoundError, version
55

66
__version__: str
7+
78
try:
8-
__version__ = importlib.metadata.version("chia-blockchain")
9-
except importlib.metadata.PackageNotFoundError:
10-
# package is not installed
9+
__version__ = version("chia-blockchain")
10+
except (PackageNotFoundError, KeyError):
1111
__version__ = "unknown"
1212

1313
try:

pytest.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ filterwarnings =
2525
ignore:cannot collect test class:pytest.PytestCollectionWarning
2626
ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning
2727
ignore:record_property is incompatible with junit_family:pytest.PytestWarning
28+
ignore:Implicit None on return values is deprecated and will raise

0 commit comments

Comments
 (0)