hate_crack.main is imported once and shared for the whole pytest
session, so any test that mutates its module globals without restoring
them leaks into every later test. test_markov_e2e assigned
main.hate_path / main.hcatHcstat2genBin directly (and before its skip
check, so it leaked even when skipped). test_main_pcfg's
test_builds_expected_subprocess reads the ambient hate_path to locate
pcfg_guesser.py and bails early when it's missing, so a leaked value
made it intermittently fail at captured_calls[0] (IndexError).
- test_markov_e2e: use monkeypatch.setattr so the globals auto-restore.
- test_main_pcfg: pin hate_path to a tmp dir containing a stub
pcfg_guesser.py, making the test hermetic and independent of both the
real pcfg_cracker submodule checkout and any leaked global state.
Full suite passes 3x consecutively; previously flaky.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>