Skip to content

tests: match the two expectations bink_index's named-file refusal left behind - #7408

Open
fiestorra wants to merge 1 commit into
ItsNotRexed:mainfrom
fiestorra:bink-named-file-refusal-expectations
Open

fiestorra wants to merge 1 commit into
ItsNotRexed:mainfrom
fiestorra:bink-named-file-refusal-expectations

Conversation

@fiestorra

Copy link
Copy Markdown
Contributor

tests: bink_index's named-file refusal has the wording its tests now check

Two test expectations were left behind by e6190e7b5 ("bink_index: a single named file that holds no stream is one error line, not a 0-stream scan", #6917), which added target_problem and the refusal for a named file that is neither a KB2 stream nor an RPF archive. That commit updated the assertion at tests/test_bink_index.py:260 to the new message and missed the one in test_a_single_named_file_that_is_not_a_stream_or_rpf_is_refused, which still looks for "not a Bink 2 stream or an RPF archive" without the (KB2).

tests/test_report_source_collision.py is red for the same tool change from the other side: make_bink() was just the sentinel text, which is not something the tool indexes, and test_a_distinct_report_path_still_works asks for a successful run. The guard order says which side is wrong: main() rejects an --out equal to the source at line 358, before it reads the file at 379, and the refusal is documented in the tool's own docstring ("A single named file has to start with KB2 or an RPF header") because a mislabelled path used to come back as a successful scan of 0 streams. The tool is doing what it now says; the fixture was the thing that no longer described a real Bink 2 stream, so make_bink() builds the same minimal header tests/test_bink_index.py:69 already uses — KB2a, size8 = 40, one frame, 16x16, 30/1 fps — with the sentinel after it so the file is still recognisable as the source the tool must not replace. That keeps both halves of the test intact: the refusal of --out == source, and a normal run that indexes one stream and leaves the input untouched.

Tested

CPU-only on b2801e26e, Windows 11, CPython 3.13; no device and no game data.

  • Before: python -I tests/test_report_source_collision.py → Ran 8 tests … FAILED (failures=1) (bink_index: error: …x.bk2: not a Bink 2 stream (KB2) or an RPF archive); python -I tests/test_bink_index.py → Ran 32 tests … FAILED (failures=1).
  • After: Ran 8 tests OK and Ran 32 tests OK. python -I -m unittest discover -s tests -p "test_bink_*.py" → Ran 74 tests, one failure, test_bink_names.TestCli.test_unreadable_mount_directory_preserves_the_report, which fails identically on plain b2801e26e with my changes stashed — a Windows-specific thing about how an unreadable directory is reported, unrelated to this change and left to whoever owns it.
  • The negative control in the file's own docstring still applies: the collision tests are the ones that catch a tool replacing its input.

AI-assisted.

…t behind

e6190e7 (ItsNotRexed#6917) added target_problem: a single named file that is neither a KB2 stream nor an RPF archive is
one error line instead of a successful scan of 0 streams. It updated the assertion at tests/test_bink_index.py:260
to the new wording and missed the one in test_a_single_named_file_that_is_not_a_stream_or_rpf_is_refused, and
tests/test_report_source_collision.py built its .bk2 as plain text, which the tool now rightly refuses. The refusal
is documented in the tool's docstring and happens before the source-overwrites guard is even relevant, so the tool
is right and the fixtures were stale: make_bink() now writes the same minimal KB2 header tests/test_bink_index.py
already builds, with the sentinel after it so the file is still recognisable as the source that must not be replaced.

On b2801e2, before: test_report_source_collision.py Ran 8 tests FAILED (failures=1), test_bink_index.py
Ran 32 tests FAILED (failures=1). After: 8/8 OK and 32/32 OK. CPU-only: no device, no game data.
@best2135

Copy link
Copy Markdown

Tested 9ceb642 on Linux (kernel 7.2), Python 3.14.8, CPU only: pass

On main (26ecd9f) test_bink_index, test_report_source_collision fail; at this head and with this head merged onto 26ecd9f they pass.

python -I tests/test_bink_index.py
python -I tests/test_report_source_collision.py

Same result as #7092, which fixes the same two tests; only one of them is needed.

AI-assisted check (Claude Code); counts and pass/fail only, no game data.

@theo-bggtt

Copy link
Copy Markdown

Tested 9ceb642 merged onto main 48ff424 on Windows 11, CPython 3.14.4, CPU only, no game files: pass.

  • Merge: clean. python -I tests/test_bink_index.py: 32 OK; python -I tests/test_report_source_collision.py: 8 OK.
  • Negative control on main 48ff424: test_a_single_named_file_that_is_not_a_stream_or_rpf_is_refused and test_a_distinct_report_path_still_works each fail, as described; nothing else in either file.
  • Code read: the new make_bink() is the exact header test_bink_index.py already uses (KB2a, size 40, one 16x16 frame, 30/1 fps) with the sentinel after it, so the collision tests still have a recognisable source. struct was already imported. compileall and git diff --check clean.
  • The test_bink_names failure you left to its owner (test_unreadable_mount_directory_preserves_the_report) is the str(OSError) backslash doubling; it is fixed by tools: print Windows paths in error messages without repr() doubling #6049 (older) and again by tools, tests: fix six standalone unit tests that fail on Windows #7425.

AI-assisted (Claude Code).

@garuspl

garuspl commented Nov 23, 2026

Copy link
Copy Markdown

Tested 9ceb642 on Windows 11 (CPU only, no GPU needed): pass

Windows 11 Pro, Python 3.14.7, CPU only (no GPU or game files involved); pytest/numpy/Pillow pinned from tests/requirements.txt in a fresh venv. Method: PR head merged onto main 51e7c9d, the PR's test files run with python -m pytest before and after the merge, plus python -m compileall -q on the changed files (clean).

  • tests/test_bink_index.py: main 1 failed / 31 passed; with the PR 32 passed (14 subtests).
  • tests/test_report_source_collision.py: main 1 failed / 7 passed; with the PR 8 passed.

AI-assisted (Claude Code, Claude Opus 5.5).

@Daazd

Daazd commented Nov 23, 2026

Copy link
Copy Markdown

Independent check (Linux, Python 3.12.3, Node 24.13, CPU only, no game files): head 9ceb6424e merged onto main 6a4299563: merges clean.

  • python3 -I tests/test_bink_index.py: Ran 32 tests in 0.017s OK (exit 0)
  • python3 -I tests/test_report_source_collision.py: Ran 8 tests in 0.253s OK (exit 0)

Fixes test_bink_index and test_report_source_collision (both red on main after #6917/#6925). #7092 fixes the same two; both pass.

AI-assisted (Claude Code).

@airp1ane

Copy link
Copy Markdown
Contributor

Tested 9ceb642 on Windows 11, Python 3.15.2, NVIDIA RTX 4060 Ti (driver 621.24; CPU-only checks, no game files, no GPU/llvm-mc/MSVC used): pass.

Ran the test files this PR adds or changes, from a clean checkout of the PR head: test_bink_index.py, test_report_source_collision.py - all exit 0.

AI-assisted (Claude Code).

@ne1i

ne1i commented Nov 23, 2026

Copy link
Copy Markdown

Tested 9ceb6424 on Linux, CPython 3.14, CPU only, synthetic inputs, merged onto main dde82f27: pass

  • python -I tests/test_bink_index.py: 32 tests OK (red on main: 1 failure).
  • python -I tests/test_report_source_collision.py: 8 tests OK (red on main: 1 failure).
  • Test-only change, so there is no tool change to revert; its absence is main, where both files fail.
  • compileall and scripts/check_no_game_data.py on the changed files: clean.

For whoever merges: #7092 turns the same two files green, edits the same test lines and also changes the tool's wording for the second guard, so the two should not both go in as they are; #7914 repairs test_bink_index.py only.

Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047.

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.

7 participants