Skip to content

fix: resolve python pytest warnings and deprecations - #155

Merged
seonghobae merged 9 commits into
developfrom
fix/issue-153-warnings-deprecations
Jun 10, 2026
Merged

fix: resolve python pytest warnings and deprecations#155
seonghobae merged 9 commits into
developfrom
fix/issue-153-warnings-deprecations

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

Summary

Resolves #154. This PR cleans up the pytest environment in services/analysis-engine so it runs with zero warnings:

  • Fixed RuntimeWarning for runpy.run_module in test_cli.py.
  • Fixed n_fft=1024 is too large for input signal warnings in test_chord_recognizer.py by generating 3.0-second synthetic signals instead of 1.0-second signals.
  • Addressed aifc, audioop, sunau deprecation warnings and audioread fallbacks in test_temporal.py by safely catching them and verifying file existence upfront.

Verification

  • export UV_PYTHON=3.12 && uv run pytest tests --cov=src/bandscope_analysis -W error passes successfully with 100% coverage and zero warnings.
  • Harness script (quickcheck.sh) passes.

@coderabbitai

coderabbitai Bot commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@seonghobae, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 42 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53b59f1c-9fe3-413b-8af9-2db2fed07641

📥 Commits

Reviewing files that changed from the base of the PR and between 1721a4f and c681235.

📒 Files selected for processing (2)
  • services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py
  • services/analysis-engine/tests/test_chord_recognizer.py
📝 Walkthrough

Walkthrough

TemporalAnalyzer.analyze 메서드에 파일 존재 여부를 사전에 확인하는 로직과 librosa.load 호출 시 경고를 억제하는 기능이 추가되었습니다. 테스트는 오디오 입력 길이를 3배로 연장하고 예상 예외 타입을 수정했습니다.

Changes

Cohort / File(s) Summary
TemporalAnalyzer 메인 로직
services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py
analyze 메서드에 파일 존재 여부 사전 확인(FileNotFoundError 발생) 및 librosa.load 호출 시 DeprecationWarning, FutureWarning 억제 기능 추가
Temporal 분석 테스트
services/analysis-engine/tests/test_temporal.py
파일 미존재 테스트 케이스의 예상 예외를 ValueError에서 FileNotFoundError로 변경
Chord 인식 테스트
services/analysis-engine/tests/test_chord_recognizer.py
모든 테스트 시나리오에서 오디오 입력 길이를 1초에서 3초로 확장 (endpoint=False, sr * 3 샘플 카운트 적용)

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • Issue #154: 테스트 스위트의 경고 및 Deprecation 메시지 해결 — librosaDeprecationWarningFutureWarning을 억제하는 변경사항이 이 이슈의 목표와 직접 연관됨

Possibly related PRs

  • PR #110: TemporalAnalyzer.analyze 함수의 동일한 부분을 수정하며 파일 존재 여부 확인 및 경고 억제 기능 구현과 관련

Poem

🐰 경고음 조용히 삼키고,
파일 찾아 미리 인사하고,
음성 길게 3배 늘려서,
더 정확한 분석을 위해
함께 나아가는 우리의 여정 🎵

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive PR 제목이 주요 변경사항과 부분적으로 관련되어 있으나, 가장 중요한 변경을 완전히 나타내지 못함. 제목을 더 구체적으로 변경 권고: 예를 들어 '파일 존재 확인 및 librosa 경고 억제' 같이 주요 코드 변경을 명확히 반영.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed PR 설명이 변경사항과 관련되어 있으며, 해결된 문제들과 검증 방법을 설명함.
Linked Issues check ✅ Passed 코드 변경이 연결된 이슈 #154의 요구사항을 충족: 파일 존재 확인, librosa 경고 억제, 신호 지속 시간 증가 등.
Out of Scope Changes check ✅ Passed 모든 변경사항이 경고 및 위험 제거라는 범위 내에 있음: 파일 검사, 신호 길이 조정, 경고 억제.
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/issue-153-warnings-deprecations
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/issue-153-warnings-deprecations

Warning

Billing warning: we have not been able to collect payment for this subscription for more than 72 hours. Please update the payment method or pay any pending invoices in Billing to avoid service interruption.


Comment @coderabbitai help to get the list of available commands and usage tips.

@seonghobae
seonghobae marked this pull request as ready for review April 25, 2026 12:13
@seonghobae
seonghobae enabled auto-merge April 25, 2026 12:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py`:
- Around line 39-40: Replace the Path(audio_path).exists() check with
Path(audio_path).is_file() to ensure only regular files (not directories or
special files) are accepted at the input boundary; keep raising
FileNotFoundError when the check fails but update the error message to reference
the actual input variable (audio_path) instead of path_str, and leave downstream
callers (e.g., librosa.load) to assume a verified file path.
- Around line 46-49: The current warnings.catch_warnings() block around the
librosa.load call ignores all DeprecationWarning/FutureWarning globally; narrow
this to only suppress warnings coming from audioread by replacing the
simplefilter calls with warnings.filterwarnings("ignore",
category=DeprecationWarning, module=r"^audioread") and
warnings.filterwarnings("ignore", category=FutureWarning, module=r"^audioread")
inside the same with warnings.catch_warnings(): context that surrounds the y, sr
= librosa.load(path_str, sr=TARGET_SR, mono=True) call so other
deprecation/future warnings still surface.

In `@services/analysis-engine/tests/test_chord_recognizer.py`:
- Line 50: Multiple tests create signals using repeated expressions like "y =
np.random.randn(22050 * 3)"; extract a shared constant or helper to compute
sample counts (e.g., SAMPLE_RATE = 22050 and DURATION_SECONDS = 3 or a helper
samples(seconds)) and replace all occurrences in the tests (references: variable
y initializations across test_chord_recognizer tests and any other tests that
build random signals) to use SAMPLE_RATE * DURATION_SECONDS or samples(3).
Update test setup/fixtures to import or define these constants/helpers so future
changes to sample rate or duration only require one edit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5e9504e5-4480-4305-a01b-81504cac8dc1

📥 Commits

Reviewing files that changed from the base of the PR and between 425ad71 and 1721a4f.

📒 Files selected for processing (3)
  • services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py
  • services/analysis-engine/tests/test_chord_recognizer.py
  • services/analysis-engine/tests/test_temporal.py

Comment thread services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py Outdated
Comment thread services/analysis-engine/src/bandscope_analysis/temporal/analyzer.py Outdated
Comment thread services/analysis-engine/tests/test_chord_recognizer.py Outdated
@seonghobae
seonghobae force-pushed the fix/issue-153-warnings-deprecations branch from 64acaf2 to d297ba8 Compare June 10, 2026 19:25
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

coderabbitai[bot]
coderabbitai Bot previously approved these changes Jun 10, 2026
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved and changes approved.

@seonghobae
seonghobae merged commit 7d5e0f9 into develop Jun 10, 2026
22 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.

Fix warnings and deprecation messages in test suite

1 participant