Drop reading of the pre-rename xautolock-inhibit.json state file
This commit is contained in:
@@ -18,7 +18,6 @@ SCRIPT = Path(os.environ.get("XIDLE_INHIBIT") or Path(__file__).resolve().parent
|
||||
BUS_NAME = "org.freedesktop.ScreenSaver"
|
||||
OBJECT_PATH = "/org/freedesktop/ScreenSaver"
|
||||
STATE_FILE = "xidle-inhibit.json"
|
||||
OLD_STATE_FILE = "xautolock-inhibit.json"
|
||||
TIMEOUT = 5.0
|
||||
DELAY = ["--release-delay", "1"]
|
||||
SETTLE = 1.5 # longer than DELAY, to check that nothing happens
|
||||
@@ -387,21 +386,6 @@ def test_old_crash_is_not_restored(sb: Sandbox) -> None:
|
||||
assert "over the 30s window" in sb.log()
|
||||
|
||||
|
||||
def test_old_state_file_is_read_once_and_deleted(sb: Sandbox) -> None:
|
||||
a = sb.client()
|
||||
old = sb.runtime / OLD_STATE_FILE
|
||||
old.write_text(json.dumps({
|
||||
"bus_id": a.conn.get_guid(), "last_cookie": 7, "stopped_at": time.time(),
|
||||
"cookies": [[7, a.name, "test-app", "Playing video"]],
|
||||
}))
|
||||
sb.start()
|
||||
assert sb.calls() == [DISABLE]
|
||||
assert "(xautolock-inhibit)" in sb.log()
|
||||
assert not old.exists()
|
||||
assert json.loads(sb.state_file.read_text())["cookies"] == [[7, a.name, "test-app", "Playing video"]]
|
||||
assert a.inhibit() == 8
|
||||
|
||||
|
||||
def test_unreadable_state_file_is_ignored(sb: Sandbox) -> None:
|
||||
sb.state_file.write_text("{not json")
|
||||
sb.start()
|
||||
|
||||
Reference in New Issue
Block a user