Skip to content

Commit ef4bc0b

Browse files
authored
Merge pull request #287 from AdvancedPhotonSource/copilot/suppress-deprecation-warning
Suppress spglib DeprecationWarning during module-level test initialization
2 parents 77931d4 + 1f5e2e6 commit ef4bc0b

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

tests/test_kvec.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import sys
99
import numpy as np
1010
import pytest
11+
import warnings
1112

1213
import importlib.util
1314
if importlib.util.find_spec('GSASII') is None:
@@ -78,15 +79,19 @@
7879

7980
try:
8081
import seekpath
81-
k_search = kvs.kVector(
82-
brav_type,
83-
pcell,
84-
ppos,
85-
nums,
86-
nuc_p,
87-
spos,
88-
threshold
89-
)
82+
# Suppress DeprecationWarning from spglib during module-level initialization
83+
# to prevent pytest from treating it as an error during test collection
84+
with warnings.catch_warnings():
85+
warnings.filterwarnings("ignore", category=DeprecationWarning)
86+
k_search = kvs.kVector(
87+
brav_type,
88+
pcell,
89+
ppos,
90+
nums,
91+
nuc_p,
92+
spos,
93+
threshold
94+
)
9095
except ModuleNotFoundError:
9196
k_search = None
9297

0 commit comments

Comments
 (0)