Fix inadvertantly persistent test artifacts
What changed, and why it matters
This commit fixes a test-code-only cleanup issue. Some tests were directly changing a shared Settings.HOSTNAME value and leaving it changed for later tests, which could make later tests behave incorrectly. The patch removes those direct assignments in two test files and replaces one with a temporary mock that automatically restores the original value. There is no change to the actual SeedSigner application code that users run, so this does not affect real devices or user security.
No security action required. This is a routine test hygiene improvement. Developers may verify that the test suite still passes and that no other tests leak Settings state.
Security signals we found
No production code modified
Test-only state isolation fix
No input handling, cryptography, or privilege changes
Evidence from the diff
The diff modifies only test files. In tests/test_flows_seed.py it removes two lines that set Settings.HOSTNAME = ‘not seedsigner-os’ inside test helper functions. In tests/test_flows_view.py it wraps a Settings.HOSTNAME = Settings.SEEDSIGNER_OS assignment inside a unittest.mock.patch.object context manager so the value is restored after the test. This prevents test artifacts from persisting across tests. No production code is changed.
Changed components
tests/test_flows_seed.pytests/test_flows_view.pyInspect captured patch +7 / −9
diff --git a/tests/test_flows_seed.py b/tests/test_flows_seed.py
index 2b2339f..98c5048 100644
--- a/tests/test_flows_seed.py
+++ b/tests/test_flows_seed.py
@@ -61,7 +61,6 @@ class TestSeedFlows(FlowTest):
the SeedOptionsView.
"""
def test_with_mnemonic(mnemonic):
- Settings.HOSTNAME = "not seedsigner-os"
sequence = [
FlowStep(MainMenuView, button_data_selection=MainMenuView.SEEDS),
FlowStep(seed_views.SeedsMenuView, is_redirect=True), # When no seeds are loaded it auto-redirects to LoadSeedView
@@ -128,7 +127,6 @@ class TestSeedFlows(FlowTest):
Most BIP-39 mnemonics should generate an error if entered as Electrum seeds.
"""
def test_with_mnemonic(mnemonic: list[str], custom_extension: str = None, expects_electrum_seed_is_valid: bool = True):
- Settings.HOSTNAME = "not seedsigner-os"
settings = Settings.get_instance()
settings.set_value(SettingsConstants.SETTING__ELECTRUM_SEEDS, SettingsConstants.OPTION__ENABLED)
diff --git a/tests/test_flows_view.py b/tests/test_flows_view.py
index 2e034cb..bdb1410 100644
--- a/tests/test_flows_view.py
+++ b/tests/test_flows_view.py
@@ -30,13 +30,13 @@ class TestViewFlows(FlowTest):
"""
Basic flow from MainMenuView to PowerOffView
"""
- Settings.HOSTNAME = Settings.SEEDSIGNER_OS
- self.run_sequence([
- FlowStep(MainMenuView, screen_return_value=RET_CODE__POWER_BUTTON),
- FlowStep(PowerOptionsView, button_data_selection=PowerOptionsView.POWER_OFF),
- FlowStep(PowerOffView), # returns BackStackView
- FlowStep(PowerOptionsView),
- ])
+ with patch.object(Settings, 'HOSTNAME', return_value=Settings.SEEDSIGNER_OS):
+ self.run_sequence([
+ FlowStep(MainMenuView, screen_return_value=RET_CODE__POWER_BUTTON),
+ FlowStep(PowerOptionsView, button_data_selection=PowerOptionsView.POWER_OFF),
+ FlowStep(PowerOffView), # returns BackStackView
+ FlowStep(PowerOptionsView),
+ ])
def test_not_yet_implemented_flow(self):
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.