Skip to content

Pytest fixes#1534

Open
CBroz1 wants to merge 28 commits intoLorenFrankLab:masterfrom
CBroz1:fix
Open

Pytest fixes#1534
CBroz1 wants to merge 28 commits intoLorenFrankLab:masterfrom
CBroz1:fix

Conversation

@CBroz1
Copy link
Member

@CBroz1 CBroz1 commented Feb 18, 2026

Description

I saw some failing tests in another PR that seemed unrelated an may have crept in while #1521 was failing tests. In this PR, I...

  • Split the remaining tri-part makes - to prevent deprecation warnings on populate calls
  • Allow db no-connect import fail in validate.py
  • Allow jsonspecifications as an editable package - because something else in the pynwb ecosystem is installing it as such
  • Prevent FileNotFound error launched by decoding_merge.py fetching process
  • Denoise the test output to make sorting through failing tests stacks easier. This includes...
    • Demoting untested logger output to 'debug' during test mode
    • Migrating all install.py print statements to Console class, that can set a quiet mode attribute
    • Monkeypatching problematic external package functions (e.g., uuid_from_stream failing to close open files)
    • disabling tqdm lines during test mode

Checklist:

  • No. If this PR should be accompanied by a release, I have updated the CITATION.cff
  • N/a. If this PR edits table definitions, I have included an alter snippet for release notes.
  • N/a. If this PR makes changes to position, I ran the relevant tests locally.
  • N/a. If this PR makes user-facing changes, I have added/edited docs/notebooks to reflect the changes
  • I have updated the CHANGELOG.md with PR number and description.

@codecov
Copy link

codecov bot commented Feb 19, 2026

Codecov Report

❌ Patch coverage is 69.87952% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.67%. Comparing base (4b72b53) to head (17eb01f).
⚠️ Report is 8 commits behind head on master.

Files with missing lines Patch % Lines
src/spyglass/spikesorting/v1/recompute.py 33.33% 14 Missing ⚠️
...yglass/position/v1/position_dlc_pose_estimation.py 0.00% 9 Missing ⚠️
src/spyglass/position/v1/position_dlc_position.py 0.00% 9 Missing ⚠️
src/spyglass/position/v1/position_dlc_centroid.py 0.00% 7 Missing ⚠️
src/spyglass/position/utils_dlc.py 79.16% 5 Missing ⚠️
src/spyglass/position/v1/position_dlc_project.py 16.66% 5 Missing ⚠️
src/spyglass/lfp/analysis/v1/lfp_band.py 25.00% 3 Missing ⚠️
src/spyglass/position/v1/position_dlc_training.py 25.00% 3 Missing ⚠️
src/spyglass/common/common_behav.py 71.42% 2 Missing ⚠️
src/spyglass/position/v1/dlc_reader.py 33.33% 2 Missing ⚠️
... and 12 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1534      +/-   ##
==========================================
- Coverage   69.92%   69.67%   -0.25%     
==========================================
  Files         117      117              
  Lines       14424    14554     +130     
==========================================
+ Hits        10086    10141      +55     
- Misses       4338     4413      +75     
Flag Coverage Δ
full-tests 69.67% <69.87%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

table_results_paths = list(
chain(
*[
part_parent_table.fetch("results_path").tolist()
Copy link
Member Author

Choose a reason for hiding this comment

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

This fetch was causing FileNotFoundError on pytest teardown

@CBroz1 CBroz1 marked this pull request as ready for review February 20, 2026 16:34
@CBroz1 CBroz1 requested a review from Copilot February 20, 2026 16:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses failing tests by implementing test output denoising, splitting tri-part makes to prevent deprecation warnings, and fixing various test-related issues. The PR migrates print statements in install.py to a Console class with quiet mode support, adds monkeypatching for external package warnings, sets environment variables to suppress verbose output during tests, and refactors logger usage to respect test mode.

Changes:

  • Denoise test output by demoting logger messages to debug level during tests, migrating install.py print statements to Console class, monkeypatching pynwb Device warnings and datajoint file handle issues, and setting environment variables for TensorFlow/tqdm/Qt
  • Refactor spikesorting v1 tables to use tri-part make pattern (make_fetch, make_compute, make_insert) to avoid transaction-related deprecation warnings
  • Fix test infrastructure including dj_config fixture extraction, stdin handling for subprocess calls, and test changes to avoid checking for specific log messages

Reviewed changes

Copilot reviewed 60 out of 61 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/conftest.py Add environment variable setup, monkeypatch pynwb/datajoint warnings, refactor dj_config fixture
tests/setup/conftest.py Add Console._quiet patch for install.py output suppression
tests/setup/test_install.py Add stdin=subprocess.DEVNULL, use dj_config fixture for DB connection
tests/utils/test_mixin.py Temporarily set logger level to INFO for cautious_delete test
tests/utils/test_graph.py Remove verbose parameters, update test assertions to avoid log checks
tests/position/v1/conftest.py Migrate deprecated pandas applymap to map
tests/position/v1/test_pos_merge.py Ensure trodes_pos_v1 fixture is populated
tests/decoding/conftest.py Add mkdir parents for netcdf mock, handle file errors during cleanup
tests/container.py Reduce container startup logging verbosity
tests/common/test_video_import_fail.py Remove model parameter from CameraDevice (NWB 2.9 compat)
tests/common/test_task_epoch_tags.py Remove caplog assertions, simplify test logic
src/spyglass/utils/mixins/base.py Add _info_msg and _warn_msg helpers that respect test mode
src/spyglass/utils/mixins/*.py Replace direct logger calls with _info_msg/_warn_msg
src/spyglass/spikesorting/v1/sorting.py Split make into make_fetch, make_compute, make_insert
src/spyglass/spikesorting/v1/recording.py Split make into make_fetch, make_compute, make_insert
src/spyglass/spikesorting/v1/metric_curation.py Update waveform extraction to load existing waveforms
src/spyglass/common/*.py Replace logger.info/warning with _info_msg/_warn_msg
src/spyglass/position/*.py Replace logger.info/warning with _info_msg/_warn_msg
src/spyglass/position/utils_dlc.py Refactor suppress_print_from_package to filter stdout/stderr
src/spyglass/decoding/decoding_merge.py Add FileNotFoundError handling in cleanup
src/spyglass/utils/database_settings.py Add "figurl" to shared modules list
scripts/install.py Migrate all print statements to Console class with quiet mode support
scripts/validate.py Add exception handling for database connection errors during import
pyproject.toml Add FutureWarning/PerformanceWarning filters, suppress thread exception warnings

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CBroz1 and others added 3 commits February 20, 2026 18:47
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Samuel Bray <sam.bray@ucsf.edu>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 61 out of 61 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 82 out of 82 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CBroz1 and others added 3 commits February 22, 2026 15:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@CBroz1 CBroz1 requested a review from samuelbray32 February 22, 2026 15:16
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.

3 participants