Skip to content

Prepare wanted-search tests and CI for normalization work - #3383

Open
mjc wants to merge 15 commits into
morpheus65535:developmentfrom
mjc:mjc/wanted-search-tests
Open

Prepare wanted-search tests and CI for normalization work#3383
mjc wants to merge 15 commits into
morpheus65535:developmentfrom
mjc:mjc/wanted-search-tests

Conversation

@mjc

@mjc mjc commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds the backend test foundation needed to safely change wanted-search behavior in follow-up PRs.

The main goal is to make wanted movie/episode searches, language parsing, profile handling, and database interactions testable with realistic rows instead of broad monkeypatching. Later PRs in this stack use this harness to harden existing paths and then move wanted-search state out of serialized columns.

What changed

  • Added transactional SQLAlchemy test fixtures backed by isolated in-memory SQLite databases.
  • Added shared wanted-search table fixtures and row factories for movie, episode, subtitle, history, profile, and failed-attempt scenarios.
  • Added shared language helpers for parsing wanted subtitle tokens, normalizing forced/HI flags, resolving audio-language data, building provider search payloads, and formatting episode display values.
  • Added pytest import/path setup so Bazarr modules can be imported consistently in backend tests.
  • Added dependency floors needed by the backend test/import path.
  • Updated CI so backend tests, frontend checks, Python compatibility, and the app smoke test run from the same workflow surface.
  • Reworked the app smoke script to wait for the UI to become responsive instead of relying on a fixed sleep.

Why this is separate

The wanted-search normalization work is easier to review if the reusable fixtures and baseline behavior tests land first. This PR intentionally keeps the storage model unchanged and focuses on testability, shared helpers, and CI reliability.

Follow-up PRs build on this layer for wanted search, mass download, provider/subtitles API paths, manual upload/download paths, sync/profile parsing, upgrade paths, and finally normalized wanted-search storage.

Tests

The added tests cover the shared language helper behavior, malformed wanted-language input, profile flag normalization, missing scene-name handling, transactional rollback isolation, and the wanted-search fixture layer itself. CI changes also exercise the backend test suite, frontend checks, and app smoke startup path from the consolidated workflow.

mjc added 2 commits June 10, 2026 12:42
Align requests floor with vendored runtime
Add shared wanted-search fixture layer

Cover wanted-search fixtures with focused tests
Comment thread .github/scripts/build_test.sh
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/test_bazarr_execution.yml
Comment thread tests/bazarr/test_wanted_search_fixtures.py
Comment thread tests/bazarr/test_language_utils_unit.py
Comment thread requirements.txt Outdated
requests>=2.33.0
PyYAML>=6.0.3
whichcraft>=0.6.1
dogpile.cache>=1.5.0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all of these were not specified but are used in the code, so I found my first bug directly in the harness I guess

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Those requirements are vendored in libs directory and listed in libs/version.txt

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not super familiar with the current state of python tooling (sqlalchemy was pretty new when I last did high-perf python), but basically everything I tried didn't notice that.

I can back that out if you'd rather.

out of curiosity why is any of it vendored at all? feels like an unusual category of app to care about supply chain resistance that much.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

We are vendoring those to prevent bugs introduced by untested versions. We can control how and when we upgrade those dependencies. We could achieve the same with proper venv if we were dealing with experimented Python users but it's unfortunately not the case most of the time. We deploy using requirements.txt the bare minimum that need to be compiled or include C library compiled for specific platforms.

@mjc
mjc marked this pull request as draft June 11, 2026 18:53
@mjc

mjc commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

noticing I have more stuff to pull into this branch from my other branches so it's draft for now

mjc added 2 commits June 11, 2026 12:54
(cherry picked from commit faa01ff)

test: add mass-download fixture support

test: complete mass-download fixture support

test: add shared wanted database binder

test: simplify wanted kind inference

test: register wanted fixtures at top level

test: drop unused transactional tmp fixture

test: bind profile lookup to wanted test database

test: bind profile list lookup to wanted fixtures
@mjc

mjc commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

perf work is still coming, just haven't had time to get it into shape yet. mjc#1 if you want an early look.

@mjc

mjc commented Jun 15, 2026

Copy link
Copy Markdown
Contributor Author

I moved a few more shared test/setup pieces into this PR so the follow-up wanted-search work can keep building on the same fixture layer.

This adds:

  • test bootstrap defaults needed for importing Bazarr under pytest
  • parse_known_args() in app.get_args so pytest/runner flags do not break imports
  • wanted-search fixture updates that use the real movie/show/episode table names
  • fixture helpers for seeding legacy missing_subtitles and failedAttempts values from normal Python sequences

The wanted-search behavior coverage that depends on this fixture layer now lives in the follow-up wanted/adaptive PR.

@mjc
mjc force-pushed the mjc/wanted-search-tests branch from 1493a84 to 735e9cf Compare June 15, 2026 19:44
@mjc
mjc marked this pull request as ready for review June 19, 2026 18:03
@morpheus65535

Copy link
Copy Markdown
Owner

I will release 1.6.0 next week. This will be part of upcoming 1.6.1-beta.X.

@mjc

mjc commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

It's a ton of work to review, I get it. Let me know if I can do anything to make this less painful.

mjc added 3 commits June 29, 2026 10:51
Resolve subsyncer import conflict by keeping lazy ffsubsync loading
and TYPE_CHECKING for ProgressInfo.
TYPE_CHECKING-only import caused NameError when the app loaded
subsyncer during smoke tests.
@morpheus65535

Copy link
Copy Markdown
Owner

Why do you use specific tags for GitHub Actions instead of major versions?

If you're on Discord, you could join us in the dev-community channel of our server. It would be easier to interact on the other PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants