Skip to content

Fix numpy deprecation warning when running tests in test_metropolis.py #7871

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

Merged
merged 2 commits into from
Jul 28, 2025

Conversation

asifzubair
Copy link
Contributor

@asifzubair asifzubair commented Jul 24, 2025

Description

This PR is an attempt to address the numpy deprecation warning (#7369). Previous attempts to make the fix (ex., #7514) focussed on checking for scalars in pymc/backends/ndarray.py. Following this hint, the present PR instead checks which offending stat variable is not respecting the scalar requirement and modifies that.

After the fix, we can see that no warnings are seen:

(pymc-dev) jovyan@75886b6f8645:~/work$ python -m pytest tests/step_methods/test_metropolis.py 
=== test session starts ===
 ...

tests/step_methods/test_metropolis.py .............................................                                               [100%]

==== 45 passed in 259.02s (0:04:19) ===

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

📚 Documentation preview 📚: https://pymc--7871.org.readthedocs.build/en/7871/

Copy link

welcome bot commented Jul 24, 2025

Thank You Banner]
💖 Thanks for opening this pull request! 💖 The PyMC community really appreciates your time and effort to contribute to the project. Please make sure you have read our Contributing Guidelines and filled in our pull request template to the best of your ability.

@asifzubair asifzubair marked this pull request as draft July 24, 2025 20:04
@asifzubair asifzubair marked this pull request as ready for review July 24, 2025 20:04
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.94%. Comparing base (dc7cfee) to head (405fd59).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7871      +/-   ##
==========================================
+ Coverage   88.25%   92.94%   +4.69%     
==========================================
  Files         116      116              
  Lines       18845    18845              
==========================================
+ Hits        16631    17515     +884     
+ Misses       2214     1330     -884     
Files with missing lines Coverage Δ
pymc/step_methods/metropolis.py 93.14% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 changed the title Fix for issue #7369: numpy deprecation warning when running tests in test_metropolis.py Fix numpy deprecation warning when running tests in test_metropolis.py Jul 28, 2025
@ricardoV94 ricardoV94 added the no releasenotes Skipped in automatic release notes generation label Jul 28, 2025
@ricardoV94 ricardoV94 merged commit 58b49f2 into pymc-devs:main Jul 28, 2025
26 checks passed
Copy link

welcome bot commented Jul 28, 2025

Congratulations Banner]
Congrats on merging your first pull request! 🎉 We here at PyMC are proud of you! 💖 Thank you so much for your contribution 🎁

@ricardoV94
Copy link
Member

Thanks @asifzubair

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance no releasenotes Skipped in automatic release notes generation tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Numpy deprecation warning issued from within test_metropolis.py
2 participants