Skip to content

fix: fix deprecation warning#153

Merged
sbillinge merged 1 commit intodiffpy:mainfrom
stevenhua0320:fix-deprecation
Feb 17, 2026
Merged

fix: fix deprecation warning#153
sbillinge merged 1 commit intodiffpy:mainfrom
stevenhua0320:fix-deprecation

Conversation

@stevenhua0320
Copy link
Contributor

@sbillinge ready to review. As followed by running pytest on the skpkg version, there is one deprecation warning as shown below:

(diffpy.structure) ~/dbs/diffpy.structure git:[main]
pytest
============================================================================================================== test session starts ==============================================================================================================
platform darwin -- Python 3.14.3, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/huarundong/dbs/diffpy.structure
configfile: pyproject.toml
collected 137 items                                                                                                                                                                                                                             

tests/test_atom.py ..                                                                                                                                                                                                                     [  1%]
tests/test_lattice.py ............                                                                                                                                                                                                        [ 10%]
tests/test_loadstructure.py ......                                                                                                                                                                                                        [ 14%]
tests/test_p_cif.py .....................                                                                                                                                                                                                 [ 29%]
tests/test_p_discus.py .....                                                                                                                                                                                                              [ 33%]
tests/test_p_pdffit.py .........                                                                                                                                                                                                          [ 40%]
tests/test_parsers.py .............                                                                                                                                                                                                       [ 49%]
tests/test_spacegroups.py .....                                                                                                                                                                                                           [ 53%]
tests/test_structure.py .......................................                                                                                                                                                                           [ 81%]
tests/test_supercell.py ...                                                                                                                                                                                                               [ 83%]
tests/test_symmetryutilities.py .....................                                                                                                                                                                                     [ 99%]
tests/test_version.py .                                                                                                                                                                                                                   [100%]

=============================================================================================================== warnings summary ================================================================================================================
tests/test_parsers.py::TestP_xyz::test_write_xyz
  /opt/miniconda3/envs/diffpy.structure/lib/python3.14/site-packages/diffpy/structure/structure.py:350: DeprecationWarning: codecs.open() is deprecated. Use open() instead.
    with codecs.open(filename, "w", encoding="UTF-8") as fp:

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================================================== 137 passed, 1 warning in 0.63s =========================================================================================================

After the fix done by this PR, I run the pip install -e . and then the pytest passed all tests without warnings as shown below:

(diffpy.structure) ~/dbs/diffpy.structure git:[fix-deprecation]
pytest
============================================================================================================== test session starts ==============================================================================================================
platform darwin -- Python 3.14.3, pytest-9.0.2, pluggy-1.6.0
rootdir: /Users/huarundong/dbs/diffpy.structure
configfile: pyproject.toml
collected 137 items                                                                                                                                                                                                                             

tests/test_atom.py ..                                                                                                                                                                                                                     [  1%]
tests/test_lattice.py ............                                                                                                                                                                                                        [ 10%]
tests/test_loadstructure.py ......                                                                                                                                                                                                        [ 14%]
tests/test_p_cif.py .....................                                                                                                                                                                                                 [ 29%]
tests/test_p_discus.py .....                                                                                                                                                                                                              [ 33%]
tests/test_p_pdffit.py .........                                                                                                                                                                                                          [ 40%]
tests/test_parsers.py .............                                                                                                                                                                                                       [ 49%]
tests/test_spacegroups.py .....                                                                                                                                                                                                           [ 53%]
tests/test_structure.py .......................................                                                                                                                                                                           [ 81%]
tests/test_supercell.py ...                                                                                                                                                                                                               [ 83%]
tests/test_symmetryutilities.py .....................                                                                                                                                                                                     [ 99%]
tests/test_version.py .                                                                                                                                                                                                                   [100%]

============================================================================================================== 137 passed in 0.66s ==============================================================================================================

@codecov
Copy link

codecov bot commented Feb 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.93%. Comparing base (25d6efd) to head (50380f5).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #153   +/-   ##
=======================================
  Coverage   98.93%   98.93%           
=======================================
  Files          13       13           
  Lines        1878     1878           
=======================================
  Hits         1858     1858           
  Misses         20       20           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sbillinge sbillinge merged commit 1b565c8 into diffpy:main Feb 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments