mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-11-02 10:52:05 +00:00
`pytest src/tests` died at 123 of 1170 tests with exit code 0 -- no summary,
no coverage report, and a shell that saw success. Four tests reach code
paths that call os._exit(0), which skips interpreter finalization and takes
pytest with it.
The os._exit is deliberate and stays: some builds with native extensions
intermittently SIGSEGV during teardown after an otherwise clean shutdown,
which is why _exit_as_main_process exists. But that reasoning applies to the
real process exit, not to a function under test. Adds _terminate(), which
raises SystemExit when PYTEST_CURRENT_TEST is set and calls os._exit
otherwise, and routes the three in-process exit paths through it.
This restores a contract the tests already assumed:
test_auto_sync_triggers_post asserts `pytest.raises(SystemExit)`. It was
written when display_menu raised, and the later switch to os._exit did not
fail that test -- it killed the runner instead, which is why nobody noticed.
The suite now runs to completion: 1160 passed, 15 failed, 16 skipped, and it
exits 1 rather than claiming success.
Those 15 were always failing; they were simply never reached. Five of them
were mine, and this is the uncomfortable part: the gen_version argument
added in 2aed95a broke more FakePasswordGenerator doubles than I found,
because the earlier regression run stopped before reaching them and I
concluded "no new failures" from a truncated result. All 20 remaining
doubles now take **_, so they absorb gen_version and anything added later
rather than needing a sweep each time the real signature grows.
The other 10 are pre-existing and unrelated -- legacy-migration and
checksum-backup failures, an index0.py int-parsing bug
(`invalid literal for int() with base 10: 'temp'`), and one that needs a TTY
this environment lacks.
Determinism gate still green.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01HtNMsKzzFTPURemX7tT19u
53 lines
1.9 KiB
Python
53 lines
1.9 KiB
Python
import sys
|
|
from pathlib import Path
|
|
from tempfile import TemporaryDirectory
|
|
from types import SimpleNamespace
|
|
|
|
from helpers import create_vault, TEST_SEED, TEST_PASSWORD
|
|
|
|
sys.path.append(str(Path(__file__).resolve().parents[1]))
|
|
|
|
from seedpass.core.entry_management import EntryManager
|
|
from seedpass.core.backup import BackupManager
|
|
from seedpass.core.manager import PasswordManager, EncryptionMode
|
|
from seedpass.core.config_manager import ConfigManager
|
|
|
|
|
|
def test_password_notes_shown(monkeypatch, capsys):
|
|
with TemporaryDirectory() as tmpdir:
|
|
tmp_path = Path(tmpdir)
|
|
vault, enc_mgr = create_vault(tmp_path, TEST_SEED, TEST_PASSWORD)
|
|
cfg_mgr = ConfigManager(vault, tmp_path)
|
|
backup_mgr = BackupManager(tmp_path, cfg_mgr)
|
|
entry_mgr = EntryManager(vault, backup_mgr)
|
|
|
|
pm = PasswordManager.__new__(PasswordManager)
|
|
pm.encryption_mode = EncryptionMode.SEED_ONLY
|
|
pm.encryption_manager = enc_mgr
|
|
pm.vault = vault
|
|
pm.entry_manager = entry_mgr
|
|
pm.backup_manager = backup_mgr
|
|
pm.password_generator = SimpleNamespace(generate_password=lambda l, i, **_: "pw")
|
|
pm.parent_seed = TEST_SEED
|
|
pm.nostr_client = SimpleNamespace()
|
|
pm.fingerprint_dir = tmp_path
|
|
pm.secret_mode_enabled = False
|
|
|
|
entry_mgr.add_entry("example.com", 8, notes="remember")
|
|
|
|
monkeypatch.setattr(
|
|
"seedpass.core.manager.clear_header_with_notification", lambda *a, **k: None
|
|
)
|
|
monkeypatch.setattr("seedpass.core.manager.pause", lambda *a, **k: None)
|
|
monkeypatch.setattr(pm, "_entry_actions_menu", lambda *a, **k: None)
|
|
|
|
pm.display_entry_details(0)
|
|
out = capsys.readouterr().out
|
|
assert "Notes: remember" in out
|
|
|
|
inputs = iter(["0", ""])
|
|
monkeypatch.setattr("builtins.input", lambda *a, **k: next(inputs))
|
|
pm.handle_retrieve_entry()
|
|
out = capsys.readouterr().out
|
|
assert "Notes: remember" in out
|