Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show FutureWarning and DeprecationWarning for pytest #4138

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
545e2a5
show FutureWarning and DeprecationWarning
DanielYang59 Oct 26, 2024
64c99d8
TODO: mark FutureWarning and DeprecationWarning for this PR
DanielYang59 Oct 26, 2024
3a79e83
Merge branch 'master' into show-deprecation-warn
DanielYang59 Oct 27, 2024
c213125
from pymatgen.core.interface import GrainBoundaryGenerator
DanielYang59 Oct 27, 2024
bc8d0ae
Suppress DeprecationWarnings on pkg_resources from pybtex
DanielYang59 Oct 27, 2024
52348ea
suppress all warning from pybtex
DanielYang59 Oct 27, 2024
0d697e9
use single quote
DanielYang59 Oct 27, 2024
35ad4ca
ignore Userwarning
DanielYang59 Oct 27, 2024
0aad506
bump plotly to avoid SyntaxWarning
DanielYang59 Oct 27, 2024
0dd7e40
DeprecationWarning: Testing an element's truth value will always retu…
DanielYang59 Oct 27, 2024
47bca8c
suppress spglib.get_symmetry
DanielYang59 Oct 27, 2024
b4bee46
fix get_vasp_input
DanielYang59 Oct 27, 2024
6a62d63
add comment
DanielYang59 Oct 27, 2024
0dad00c
replace piezo sensitivity
DanielYang59 Oct 27, 2024
f693604
suppress warning
DanielYang59 Oct 27, 2024
f84bfd3
suppress known bader warning
DanielYang59 Oct 27, 2024
4b92c08
add comment for something Im unable to fix
DanielYang59 Oct 27, 2024
1d9f673
fix lammps input
DanielYang59 Oct 27, 2024
bc5024f
n_elems
DanielYang59 Oct 27, 2024
846c5fa
simplify warning filter in test
DanielYang59 Oct 27, 2024
a122ec9
fix get_vasp_input
DanielYang59 Oct 27, 2024
bc755b2
avoid warning leakage
DanielYang59 Oct 27, 2024
8c1cee5
fix lobster
DanielYang59 Oct 27, 2024
401df09
replace phonopy
DanielYang59 Oct 27, 2024
856bfc0
revert filter warn for that we might want to fix
DanielYang59 Oct 27, 2024
050bf49
fix pandas na filter
DanielYang59 Oct 27, 2024
d5a749d
enhance filter msg
DanielYang59 Oct 27, 2024
2f54d9d
NEED CONFIRM: replace plotly colorbar
DanielYang59 Oct 27, 2024
80d3d6a
suppress intended test for MaterialsProjectCompatibility
DanielYang59 Oct 27, 2024
96ff0e3
fix pd.read_json
DanielYang59 Oct 27, 2024
1ec42d9
replace matrix with array
DanielYang59 Oct 27, 2024
6ed8a65
suppress too many figure warning
DanielYang59 Oct 27, 2024
a1538f9
fix openff
DanielYang59 Oct 27, 2024
3dd3a3b
clean up warning filter
DanielYang59 Oct 27, 2024
241621a
add comment
DanielYang59 Oct 27, 2024
041c874
filter intended usage
DanielYang59 Oct 27, 2024
e4df7b3
clean up warn filter
DanielYang59 Oct 27, 2024
e01dec6
revert plotly bump
DanielYang59 Oct 27, 2024
e69e3f0
enhance comment
DanielYang59 Oct 27, 2024
c9e4301
Merge branch 'master' into show-deprecation-warn
DanielYang59 Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ dependencies = [
"joblib>=1",
"matplotlib>=3.8",
"monty>=2024.7.29",
"networkx>=3", # PR #4116
"networkx>=3", # PR4116
"palettable>=3.3.3",
"pandas>=2",
"plotly>=4.5.0",
"plotly>=5.0.0", # PR4138
DanielYang59 marked this conversation as resolved.
Show resolved Hide resolved
"pybtex>=0.24.0",
"requests>=2.32",
"ruamel.yaml>=0.17.0",
Expand Down Expand Up @@ -252,7 +252,20 @@ docstring-code-format = true
"dev_scripts/*" = ["D"]

[tool.pytest.ini_options]
addopts = "--durations=30 --quiet -r xXs --color=yes -p no:warnings --import-mode=importlib"
addopts = "--durations=30 --quiet -r xXs --color=yes --import-mode=importlib"
filterwarnings = [
"ignore::UserWarning", # Ignore all warnings
# # "default::FutureWarning", # Show FutureWarnings
# # "default::DeprecationWarning", # Show DeprecationWarnings
# # TODO: WIP, remove afterwards
# "default::FutureWarning", # Show FutureWarnings
# "default::DeprecationWarning", # Show DeprecationWarnings
# TODO: for some reason filter doesn't work on MacOS
# ref: https://github.com/pytest-dev/pytest/issues/11630
'ignore:pkg_resources is deprecated as an API:DeprecationWarning',
'ignore:distutils Version classes are deprecated:DeprecationWarning',
'ignore:Deprecated call to `pkg_resources.declare_namespace:DeprecationWarning',
]

[tool.coverage.run]
parallel = true
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/io/vasp/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,7 @@ def _parse_structure(self, elem: XML_Element) -> Structure:
@staticmethod
def _parse_diel(elem: XML_Element) -> tuple[list, list, list]:
"""Parse dielectric properties."""
if elem.find("real") and elem.find("imag"):
if elem.find("real") is not None and elem.find("imag") is not None:
DanielYang59 marked this conversation as resolved.
Show resolved Hide resolved
imag = [
[_vasprun_float(line) for line in r.text.split()] # type: ignore[union-attr]
for r in elem.find("imag").find("array").find("set").findall("r") # type: ignore[union-attr]
Expand Down
2 changes: 1 addition & 1 deletion src/pymatgen/transformations/advanced_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
from pymatgen.analysis.bond_valence import BVAnalyzer
from pymatgen.analysis.energy_models import SymmetryModel
from pymatgen.analysis.ewald import EwaldSummation
from pymatgen.analysis.gb.grain import GrainBoundaryGenerator
from pymatgen.analysis.local_env import MinimumDistanceNN
from pymatgen.analysis.structure_matcher import SpinComparator, StructureMatcher
from pymatgen.analysis.structure_prediction.substitution_probability import SubstitutionPredictor
from pymatgen.command_line.enumlib_caller import EnumError, EnumlibAdaptor
from pymatgen.command_line.mcsqs_caller import run_mcsqs
from pymatgen.core import DummySpecies, Element, Species, Structure, get_el_sp
from pymatgen.core.interface import GrainBoundaryGenerator
from pymatgen.core.surface import SlabGenerator
from pymatgen.electronic_structure.core import Spin
from pymatgen.io.ase import AseAtomsAdaptor
Expand Down
2 changes: 1 addition & 1 deletion tests/transformations/test_advanced_transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from pytest import approx

from pymatgen.analysis.energy_models import IsingModel, SymmetryModel
from pymatgen.analysis.gb.grain import GrainBoundaryGenerator
from pymatgen.core import Lattice, Molecule, Species, Structure
from pymatgen.core.interface import GrainBoundaryGenerator
from pymatgen.core.surface import SlabGenerator
from pymatgen.io.icet import ClusterSpace
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
Expand Down