mirror of
https://github.com/saphid/frame-control.git
synced 2026-10-06 06:00:33 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6fb5e917a |
No files matched your search
+4
-1
@@ -36,6 +36,7 @@ def zip_bytes(files, links=()):
|
|||||||
return buf.getvalue()
|
return buf.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipIf(sys.platform == "win32", "the helper runs on the Frame (Linux): /proc, flock and POSIX prefix paths")
|
||||||
class FakeLibrary(unittest.TestCase):
|
class FakeLibrary(unittest.TestCase):
|
||||||
"""A Steam library with Gravitas's real layout, and pinned downloads served from memory."""
|
"""A Steam library with Gravitas's real layout, and pinned downloads served from memory."""
|
||||||
|
|
||||||
@@ -230,9 +231,10 @@ class Downloads(FakeLibrary):
|
|||||||
|
|
||||||
class Actions(FakeLibrary):
|
class Actions(FakeLibrary):
|
||||||
def test_one_change_at_a_time(self):
|
def test_one_change_at_a_time(self):
|
||||||
|
import fcntl
|
||||||
lock = Path(tempfile.mkdtemp()) / "mods.lock"
|
lock = Path(tempfile.mkdtemp()) / "mods.lock"
|
||||||
with mock.patch.object(frame_mods, "LOCK", lock), open(lock, "w") as held:
|
with mock.patch.object(frame_mods, "LOCK", lock), open(lock, "w") as held:
|
||||||
frame_mods.fcntl.flock(held, frame_mods.fcntl.LOCK_EX)
|
fcntl.flock(held, fcntl.LOCK_EX)
|
||||||
with self.assertRaisesRegex(frame_mods.Fail, "another mod action"):
|
with self.assertRaisesRegex(frame_mods.Fail, "another mod action"):
|
||||||
frame_mods.main(["install", str(APPID)])
|
frame_mods.main(["install", str(APPID)])
|
||||||
self.assertFalse(frame_mods.status(APPID)["installed"])
|
self.assertFalse(frame_mods.status(APPID)["installed"])
|
||||||
@@ -294,6 +296,7 @@ class Start(FakeLibrary):
|
|||||||
|
|
||||||
|
|
||||||
class Helper(unittest.TestCase):
|
class Helper(unittest.TestCase):
|
||||||
|
@unittest.skipIf(sys.platform == "win32", "uninstall takes the flock lock, which only exists on the Frame (Linux)")
|
||||||
def test_unexpected_errors_are_still_json(self):
|
def test_unexpected_errors_are_still_json(self):
|
||||||
# A receipt from another version, without "exe": a KeyError, not a traceback.
|
# A receipt from another version, without "exe": a KeyError, not a traceback.
|
||||||
script = (ROOT / "ui" / "frame_mods.py").read_text().replace(
|
script = (ROOT / "ui" / "frame_mods.py").read_text().replace(
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,6 @@ from python.org, each checked against a pinned hash. Files live in
|
|||||||
<prefix>/drive_c/frame-control, never in the game's own folder, and a receipt
|
<prefix>/drive_c/frame-control, never in the game's own folder, and a receipt
|
||||||
records what to remove.
|
records what to remove.
|
||||||
"""
|
"""
|
||||||
import fcntl
|
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@@ -511,6 +510,7 @@ def main(argv):
|
|||||||
action = {"status": status, "install": install, "start": start, "uninstall": uninstall}[argv[0]]
|
action = {"status": status, "install": install, "start": start, "uninstall": uninstall}[argv[0]]
|
||||||
if action is status:
|
if action is status:
|
||||||
return status(int(argv[1]))
|
return status(int(argv[1]))
|
||||||
|
import fcntl # only on the Frame; the server and its tests also import this module on Windows
|
||||||
# One change at a time, or an uninstall could delete what an install is moving in.
|
# One change at a time, or an uninstall could delete what an install is moving in.
|
||||||
LOCK.parent.mkdir(parents=True, exist_ok=True)
|
LOCK.parent.mkdir(parents=True, exist_ok=True)
|
||||||
with open(LOCK, "w") as lock:
|
with open(LOCK, "w") as lock:
|
||||||
|
|||||||
Reference in new issue
Block a user