Make a deprecated name an error in tests and snippets - #498
Conversation
The shims exist for users on the old paths, and the tests and the guides are not users: a deprecation warning in either is a defect that a log line nobody reads does not surface. pytest now turns any phonometry rename warning into an error, which the one file that exercises the shims on purpose passes because pytest.warns catches under an error filter, and the snippet runner injects the same filter into every page script, so a guide that teaches an alias fails the gate that runs it. Both were proven to bite: a scratch test that uses a legacy path fails naming the module, and a scratch page does the same. The sweep that preceded the filter found the suite and the snippets already clean but for three lines of prose: the CNOSSOS test-data README naming the pre-4.0 module paths for both workbooks, and a cross-reference in the NTFF test docstring pointing at the flat materials namespace. The full suite passes under the filter, 7991 tests in nine and a half minutes.
|
You've reached the fair usage limit for the Bito Code Review Agent trial. Upgrade to a paid plan or contact support@bito.in for assistance. Learn more |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideTreat any use of deprecated phonometry names as errors in tests and documentation snippets, and update remaining references to old module paths in test documentation. Sequence diagram for running doc snippets with deprecated phonometry names treated as errorssequenceDiagram
participant check_doc_snippets_py as check_doc_snippets
participant _run_page as _run_page
participant python as PythonSnippet
participant warnings as warnings_module
participant phonometry as phonometry_shim
check_doc_snippets_py->>_run_page: _run_page(page)
_run_page->>python: write_text(script with warnings.filterwarnings)
python->>warnings: filterwarnings('error', message='.*is deprecated since phonometry.*', category=DeprecationWarning)
python->>phonometry: [access deprecated name]
phonometry-->>python: DeprecationWarning
warnings-->>python: [DeprecationWarning becomes error]
python-->>_run_page: script failure (stderr tail)
_run_page-->>check_doc_snippets_py: (page, stderr_tail)
Flow diagram for pytest treating deprecated phonometry warnings as errorsflowchart LR
A[pytest start] --> B[load pyproject.toml]
B --> C[apply filterwarnings]
C --> D[run test using phonometry_shim]
D --> E[DeprecationWarning with message 'is deprecated since phonometry']
E --> F[filterwarnings matches pattern]
F --> G[raise as error]
G --> H[test fails]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe change makes matching phonometry deprecation warnings fail in pytest and documentation snippet execution. It also updates CNOSSOS and NTFF documentation references to current module paths. ChangesDeprecation migration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #498 +/- ##
=======================================
Coverage 96.99% 96.99%
=======================================
Files 272 272
Lines 38575 38575
=======================================
Hits 37416 37416
Misses 1159 1159 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Numerical conformance report✅ 533/533 conformance checks pass across 57 domains and 362 standards - filters class 1 - weightings within IEC 61672-1 class 1. Each row pins a standard clause to its expected normative value and the value the library computes. Every section below is collapsible and stays collapsed while all of its rows pass; a section with any failing row opens automatically. ✅ Numerical validation - filters & weightings: class showcase (IEC 61260-1 · IEC 61672-1 · ISO 7196)IEC 61260-1:2014 class per filter architecture (order 6, one-third-octave, 100 Hz-10 kHz, fs = 48 kHz). For each architecture the table shows, at its binding band, the measured relative attenuation and the class-1 limit it must clear, so the number and the range it must sit in are both visible. A positive margin means the acceptance limits are met with that much room.
Only Butterworth (the library default) and Chebyshev-II are class-compliant architectures. Chebyshev-I and elliptic trade the mask for passband ripple, and Bessel for a maximally-flat group delay (soft rolloff); they cannot satisfy the IEC 61260-1 Class 1/2 attenuation mask by construction, so they are labelled By design - this is expected, not a failure or regression. Frequency-weighting conformance (A/C: IEC 61672-1 Table 3; G: ISO 7196 A.3). The max deviation from nominal is informational (it falls at a frequency extreme where the tolerance is widest and asymmetric); compliance is judged at the binding frequency - the one with the least headroom - where the deviation, the applicable tolerance band and the headroom are shown together.
✅ Filters & weightings: 100% (10/10)
✅ Levels & dosimetry: 100% (9/9)
✅ Room & building acoustics: 100% (72/72)
✅ Room acoustics: 100% (16/16)
✅ Psychoacoustics: 100% (14/14)
✅ Speech transmission (IEC 60268-16): 100% (10/10)
✅ System measurement (Golay / Kirkeby / Mueller-Massarani): 100% (5/5)
✅ Intensity & sound power: 100% (10/10)
✅ Building prediction & uncertainty: 100% (15/15)
✅ Outdoor propagation & occupational exposure: 100% (10/10)
✅ Materials: absorption, airflow & impedance: 100% (6/6)
✅ Scattering & diffusion (ISO 17497): 100% (14/14)
✅ In-situ road absorption (ISO 13472): 100% (3/3)
✅ Precision sound power (ISO 3745 / 9614-3): 100% (4/4)
✅ Human vibration (ISO 8041 / 2631 / 5349): 100% (15/15)
✅ Speech intelligibility (ANSI S3.5-1997): 100% (24/24)
✅ Objective intelligibility (STOI / ESTOI): 100% (3/3)
✅ Impulsive-sound prominence (NT ACOU 112): 100% (2/2)
✅ Impulsive-sound prominence (ISO/PAS 1996-3): 100% (2/2)
✅ Room noise (ANSI S12.2-2019): 100% (3/3)
✅ Hearing threshold (ISO 7029 / ISO 389-7): 100% (3/3)
✅ Measurement uncertainty (GUM / Supplement 1): 100% (7/7)
✅ Noise-induced hearing loss (ISO 1999): 100% (6/6)
✅ Multiple-shock whole-body vibration (ISO 2631-5): 100% (6/6)
✅ Sound absorption in enclosed spaces (EN 12354-6): 100% (2/2)
✅ Prominent discrete tones (ECMA-418-1): 100% (2/2)
✅ Tonal audibility (ISO/PAS 20065): 100% (11/11)
✅ Psychoacoustic annoyance & fluctuation strength (Fastl & Zwicker): 100% (3/3)
✅ Electroacoustics: distortion & frequency response: 100% (20/20)
✅ Calibrated spectral analysis (Bendat & Piersol): 100% (12/12)
✅ Multiple-input coherence (Bendat & Piersol): 100% (5/5)
✅ Time-frequency analysis (Bendat & Piersol): 100% (3/3)
✅ Correlation, time delay and envelope (B&P / Knapp & Carter): 100% (7/7)
✅ Cepstrum, liftering and envelope spectrum (Havelock / B&P): 100% (3/3)
✅ Time synchronous averaging (McFadden 1987): 100% (5/5)
✅ Data qualification and Rice statistics (Bendat & Piersol): 100% (8/8)
✅ Underwater acoustics (ISO 18405/17208/18406): 100% (6/6)
✅ Underwater sound propagation (transmission loss): 100% (16/16)
✅ Underwater propagation regimes (Weston flux theory): 100% (3/3)
✅ Marine-mammal auditory weighting (NMFS / Southall): 100% (4/4)
✅ Underwater numerical propagation (modes / rays / PE): 100% (4/4)
✅ Aircraft noise (ICAO Annex 16 / IEC 61265): 100% (15/15)
✅ Rotorcraft noise (ECAC Doc 32 / NORAH2): 100% (12/12)
✅ CNOSSOS-EU road source (Directive 2002/49/EC Annex II): 100% (6/6)
✅ Wind-turbine noise (IEC 61400-11): 100% (3/3)
✅ Porous & multilayer absorbers (Mechel / Bies / Cox & D'Antonio): 100% (20/20)
✅ Slow-sound perfect absorbers (Jimenez et al. Appl. Sci. 2017): 100% (3/3)
✅ Program loudness (ITU-R BS.1770 / EBU R 128): 100% (8/8)
✅ 2D FDTD wave simulation (Attenborough & Van Renterghem 2021, Ch. 4): 100% (4/4)
✅ Swept-sine distortion & phase utilities (Farina / Novak): 100% (7/7)
✅ Spherical ground & barriers (Attenborough / Salomons / Bies): 100% (7/7)
✅ Panel & aperture sound insulation (Bies / Hopkins / Cremer): 100% (17/17)
✅ Bending-wave plate-junction transmission (Cremer / Craik / Hopkins): 100% (6/6)
✅ Atmospheric refraction (Salomons rays / GFPE): 100% (3/3)
✅ Electroacoustics: 100% (9/9)
✅ Industrial noise control: 100% (22/22)
✅ CNOSSOS-EU railway source (Directive 2002/49/EC Annex II): 100% (8/8)
Tests & coverage — 48084 tests, 0 failures (✅ all green)
Conformance harness: |
|



The compatibility shims exist for users on the old paths, and the tests and
the guides are not users: a deprecation warning in either is a defect that a
log line nobody reads does not surface.
Two halves, one rule:
pytestturns any phonometry rename warning into an error(
filterwarningsinpyproject.toml). The one file that exercises theshims on purpose,
tests/test_deprecated_aliases.py, passes unchanged:pytest.warnscatches under an error filter. Proven to bite with a scratchtest that uses a legacy path and fails naming the module; the full suite
passes under the filter, 7991 tests in nine and a half minutes.
guide that teaches an alias fails the gate that runs it. All 3614 blocks
over 505 pages pass today; a scratch page with one legacy use fails.
The sweep that preceded the filter found only three lines of prose still on
old paths, all fixed here: the CNOSSOS test-data README named the pre-4.0
module for both workbooks, and the NTFF test docstring cross-referenced the
flat materials namespace. One subtlety worth recording: a bare
importof ashimmed module warns nothing, because PEP 562 fires on attribute access, so
the filter catches use, which is what matters, rather than mention.
Summary by Sourcery
Enforce deprecated phonometry names as hard errors in tests and documentation snippets and update remaining references to legacy module paths.
Bug Fixes:
Enhancements:
Documentation:
Summary by CodeRabbit
Documentation
Tests